Bodoconsult.Core.Typography 1.0.1

.NET Standard 2.0
dotnet add package Bodoconsult.Core.Typography --version 1.0.1
NuGet\Install-Package Bodoconsult.Core.Typography -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Bodoconsult.Core.Typography" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Bodoconsult.Core.Typography --version 1.0.1
#r "nuget: Bodoconsult.Core.Typography, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Bodoconsult.Core.Typography as a Cake Addin
#addin nuget:?package=Bodoconsult.Core.Typography&version=1.0.1

// Install Bodoconsult.Core.Typography as a Cake Tool
#tool nuget:?package=Bodoconsult.Core.Typography&version=1.0.1

What does the library

Bodoconsult.Core.Typography is a base class containing properties and methods around typographic settings for paper reports and / or charts. The itention of this library is to store a complete typographic set of properties outside the app in an adjustable JSON file and to read it from there if needed.

The library contains three predefined typographic sets for common use cases in the classes called DefaultTypographyPageHeader, CompactTypographyPageHeader and ElegantTypographyPageHeader. The default paper format is DIN A4 portrait.

DefaultTypographyPageHeader is a typographic style set for a normal paper report. It is a compromiss between use of space and elegance.

CompactTypographyPageHeader is a typographic style set for compact paper report intended to get as much information as possible on a given paper format.

ElegantTypographyPageHeader is a typograhic style set preferring elegance over use of space. It needs more pages of paper per given information to print.

How to use the library

The source code contain NUnit test classes, the following source code is extracted from. The samples below show the most helpful use cases for the library.

Basic usage

        var t = new ElegantTypographyPageHeader("Cambria", "Cambria", "Cambria")
                    {
                        LogoPath = @"C:\bodoconsult\Logos\logo.jpg"
                    };
					
        t.SetMargins();
		

Customizing a typographic set

        var t = new ElegantTypographyPageHeader("Cambria", "Cambria", "Cambria")
                    {
                        LogoPath = @"C:\bodoconsult\Logos\logo.jpg",
						FontSize = 12,
                    };
					
        t.SetMargins();

Creating your user-defined typographic set

The following example shows the implementation of a user-defined typographic set.

/// <summary>
/// Provides your user-defined typograph based on sans serif fonts at default. See non-default constructor to change fonts
/// </summary>
public class UserDefinedTypographyPageHeader : TypographyBase
{
    /// <summary>
    /// Default ctor. Sets font names to Calibri
    /// </summary>
    public UserDefinedTypographyPageHeader()
    {
        BaseConstructor("Calibri", "Calibri", "Calibri");
    }

    /// <summary>
    /// Ctor to set font names
    /// </summary>
    /// <param name="primaryFontname">Font name for text</param>
    /// <param name="secondaryFontName">Font name for headings</param>
    /// <param name="thirdFontName">Font name for titles</param>
    public UserDefinedTypographyPageHeader(string primaryFontname, string secondaryFontName, string thirdFontName)
    {
        BaseConstructor(primaryFontname, secondaryFontName, thirdFontName);
    }

    private void BaseConstructor(string primaryFontname, string secondaryFontName, string thirdFontName)
    {
        // Default page DIN A4 
        PageHeight = 29.4;
        PageWidth = 21.0;

        FontName = primaryFontname;
        FontSize = 11;
        SmallFontSize = FontSize - 2;
        ExtraSmallFontSize = SmallFontSize - 2;

		LogoPath = @"C:\bodoconsult\Logos\logo.jpg";

        HeadingFontName = secondaryFontName;
        HeadingFontSize5 = FontSize;
        HeadingFontSize4 = HeadingFontSize5;
        HeadingFontSize3 = HeadingFontSize4;
        HeadingFontSize2 = HeadingFontSize3;
        HeadingFontSize1 = HeadingFontSize2 + 2;

        LineHeight = 0.5;
        ColumnDividerWidth = 0.5;
        ColumnWidth = 2.0;
        ColumnCount = 6;
        DotsPerInch = 300;
        LogoWidth = 2 * ColumnWidth + ColumnDividerWidth;

        TitleFontName = thirdFontName;
        SubTitleFontName = thirdFontName;

        TitleFontSize = HeadingFontSize1 + 4;
        SubTitleFontSize = HeadingFontSize1 + 2;


        MarginLeftFactor = 2.5;
        MarginRightFactor = 2.5;
        MarginTopFactor = 3;
        MarginBottomFactor = 2;

        SetMargins();

        PageFooterHeight = 0.5;
        PageHeaderHeight = 1.5;
        PageHeaderMargin = 1.5;
        PageFooterMargin = ColumnDividerWidth;


        ChartStyle = new ChartStyle
        {
            FontName = FontName,
            TitleFontName = HeadingFontName,
            FontSize = (float)FontSize,
            Width = GetPixelWidth(6),
            Height = GetPixelHeight(6),
            PaperColor = Color.White
        };

        TableBodyBackground = Color.White;
        TableHeaderBackground = Color.White;
        TableBodyUnborderedBackground = Color.Transparent;
        TableHeaderUnborderedBackground = Color.Transparent;
        TableCornerRadius = 0.3;
        TableBorderWidth = 0.05;
        TableBorderColor = Color.FromArgb(178, 204, 255);

    }
}

About us

Bodoconsult http://www.bodoconsult.de is a Munich based software company from Germany.

Robert Leisner is senior software developer at Bodoconsult. See his profile on http://www.bodoconsult.de/Curriculum_vitae_Robert_Leisner.pdf.

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48 net481
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Bodoconsult.Core.Typography:

Package Downloads
Bodoconsult.Core.Charting

Charting library based on ScottPlot library for easy charting of database data

Bodoconsult.Core.Charting.Base

Charting base library for easy charting of database data

Bodoconsult.Core.Text.Pdf

Enhances Bodoconsult.Core.Text, a simple class for collecting structured text in an app, with an export of the text to PDF. Use library to create simple reports from apps or from unit testing i.e. for auditors or as documentation.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 340 12/15/2022
1.0.0 821 10/28/2020

Added readme