Background Color:
 
Background Pattern:
Reset
Search
Home Recent Changes Show All Pages

Fonts and font file embedding

Not Rated Yet

Scryber supports the dynamic inclusion of standard and OpenType fonts referenced in the template

 

Standard Fonts

Scryber supports the standard 14 fonts always available in PDF documents
As per Adobe standards, it is not best practice to use these fonts. However, they do not need embedding and create very small files sizes for simple documents.

These fonts are....

  • Helvetica - Regular, Bold, Italic and Bold Italic
  • Times - Regular, Bold, Italic and Bold Italic
  • Courier - Regular, Bold, Italic and Bold Italic
  • Symbol
  • Zapf Dingbats
By simply specifying Helvetica, Times, Courier, as the font-family one of these faces will be used.

 

<pdf:Label style:font-family="Helvetica" >This is Helvetica</pdf:Label><pdf:Br/>
 <pdf:Label style:font-family="Times" >This is Times</pdf:Label><pdf:Br/>
<pdf:Label style:font-family="Courier" >This is Courier</pdf:Label><pdf:Br/>

This snippet will generate the following

 

Standard Font styles

The fonts are by default rendered in the regular variant. Bold and Italic variants are used by specifying the appropriate style flags

<pdf:Label style:font-family="Times" >This is Times Regular</pdf:Label><pdf:Br/>
<pdf:Label style:font-family="Times" style:font-bold="true" >This is Times Bold</pdf:Label><pdf:Br/>
<pdf:Label style:font-family="Times" style:font-italic="true" >This is Times Italic</pdf:Label><pdf:Br/>
<pdf:Label style:font-family="Times" style:font-italic="true" style:font-bold="true" >This is Times Bold Italic</pdf:Label>

This snippet will generate the following

 

Open Type Fonts

Fonts and font variants can be included quickly and simply in a pdf by referencing them with their family name.

<pdf:Label style:font-family="Calibri" >This is Calibri</pdf:Label><pdf:Br/>
<pdf:Label style:font-family="Calibri" style:font-bold="true" >This is Calibri Bold</pdf:Label><pdf:Br/>
<pdf:Label style:font-family="Bauhaus 93" >This is Bauhaus 93</pdf:Label><pdf:Br/>
<pdf:Label style:font-family="Book Antiqua" style:font-bold="true" >This is Book Antiqua</pdf:Label>

System Fonts

When scryber starts up, then by default, it runs a quick inspection of the system fonts directory looking for Open Type (TrueType&tm;) fonts. This is held as a list of fonts that can be used.
Once the list of fonts is known, then they can be referenced by family name and variant

The Fonts directory is expected to exist at the path [SystemDir]/Fonts where [SystemDir] is the path returned from System.Environment.GetFolderPath(Environment.SpecialFolder.System)

Custom font directory or file

A second directory of specific fonts can also be included by specifying in the fonts configuration section, and you can also specify explicit family names and styles to discreet files.

These fonts will be available to scryber but are not installed on the operating system the process is running from or available to other applications

It is also possible to not use any of the systems fonts by explicitly excluding this with the fonts configuration section

Resource Fonts

If you are distributing an application which uses custom fonts, that should not be installed on a users machine, nor should the end user be able to access the font file and install it themselves, then it is possible to embed the file itself as a resource within an assembly, and reference it from the configuration file.

 

Checking order and font fall back

When using a font referenced in a template scryber will first check the explicit resources, files and any explicitly specified directory for a match to the font. If it is not found or they are empty, then it will check the system fonts (if enabled) for a match.
If it is still not found then and if the style is not regular, it will check back at the start for the regular variant and try to match that.
If even the regular variant is not found, then it will check if font substitution is enabled in the configuration section. If so then it will fall back to the PDF standard Courier font, otherwise an exception will be raised.

<pdf:Label style:font-family="Does Not Exist" >This font does not exist, 
        so it will fall back to Courier if enabled in the configuration.</pdf:Label>

 

Font Embedding

Every font file carries with it's information and indicator of it's use. The indicator can specify if the font can be embedded, and if it is not set, then the actual font itself should not, and is not embedded in the PDF document. This option cannot be overridden, and is legally enforceable to comply with this option.

If the font can be embedded, then scryber will always include the actual font file data within the generated PDF document. This font data is for each variant of the font so a bold variant will have it's own bold font file within the PDF.

At the moment scryber embeds the complete font data file, rather than a subset of glyphs with readers can support
This can make PDF files large - especially if the font supports the full unicode character set. Currently Arial Unicode is around 28Mb in size.

 

Unicode support

Scryber supports all unicode characters these characters are mapped directly to the glyphs in the font file, however is the glyph is not present in the font file it cannot be identified, and therefore will not be rendered in the final PDF by the reader. When using unicode character sets, make sure the font in use supports those characters.

<pdf:Para style:font-family="Arial">
                    因此,這的確是:她現在只有十英寸高了,她的臉亮起來的想法,她現在是正確的大小經歷的小門進入可愛的小花園。但是,首先,她又等了幾分鐘,看看她是否打算進一步萎縮的話:她覺得這有點緊張,“因為它可能會結束,你知道, '在我走出去了。愛麗絲對自己說, '像蠟燭。我不知道我應該是這樣呢? “她努力試著想像一個什麼蠟燭的火焰就像是後蠟燭吹出來的,因為她不記得曾經看過這樣的事情。
                    過了一段時間.
        </pdf:Para>
        <pdf:Para style:font-family="Arial Unicode MS">
                    因此,這的確是:她現在只有十英寸高了,她的臉亮起來的想法,她現在是正確的大小經歷的小門進入可愛的小花園。但是,首先,她又等了幾分鐘,看看她是否打算進一步萎縮的話:她覺得這有點緊張,“因為它可能會結束,你知道, '在我走出去了。愛麗絲對自己說, '像蠟燭。我不知道我應該是這樣呢? “她努力試著想像一個什麼蠟燭的火焰就像是後蠟燭吹出來的,因為她不記得曾經看過這樣的事情。
                    過了一段時間.
        </pdf:Para>

 

Unsupported Font Formats

Currently scryber only supports the simple Open Type font format. It does not Support any of the Postscript type fonts



  Rating
Rate This Page: Poor Great   |  Rate Content |
Average rating:  No Ratings Yet   
Number of Ratings : 0
  Comments
Add Comment
No Comments Yet