Bodoconsult.Core.Typography
1.0.1
dotnet add package Bodoconsult.Core.Typography --version 1.0.1
NuGet\Install-Package Bodoconsult.Core.Typography -Version 1.0.1
<PackageReference Include="Bodoconsult.Core.Typography" Version="1.0.1" />
paket add Bodoconsult.Core.Typography --version 1.0.1
#r "nuget: Bodoconsult.Core.Typography, 1.0.1"
// 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 Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.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.Base
Charting base library for easy charting of database data |
|
Bodoconsult.Core.Charting
Charting library based on ScottPlot 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.
Added readme