 |
VectSharp
2.2.1
A light library for C# vector graphics
|
19 using System.Collections.Generic;
99 for (
int i = 0; i < fallback.Length; i++)
152 for (
int i = 0; i < fallback.Length; i++)
188 private Dictionary<string, string> KnownFonts =
new Dictionary<string, string>();
189 private Dictionary<string, string> NotLoadedFonts =
new Dictionary<string, string>();
190 private Dictionary<string, FontFamily> LoadedFonts =
new Dictionary<string, FontFamily>();
200 for (
int i = 0; i < 14; i++)
205 Fallbacks[stdFF] = resolved;
263 for (
int i = 0; i < 14; i++)
298 public SimpleFontLibrary(
string timesRoman,
string timesBold,
string timesItalic,
string timesBoldItalic,
299 string helvetica,
string helveticaBold,
string helveticaOblique,
string helveticaBoldOblique,
300 string courier,
string courierBold,
string courierOblique,
string courierBoldOblique,
301 string symbol,
string zapfdingbats)
321 for (
int i = 0; i < 14; i++)
346 this.LoadedFonts[fontFamilyName] = fontFamily;
347 this.KnownFonts[fontFamilyName] = fontFamilyName;
373 public void Add(
string fileName)
388 public void Add(
string fontFamily,
string fileName)
390 this.KnownFonts[fontFamily] = fontFamily;
391 this.NotLoadedFonts[fontFamily] = fileName;
397 return Fallbacks[standardFontFamily];
403 if (KnownFonts.TryGetValue(fontFamily, out
string knownFontName))
405 if (LoadedFonts.TryGetValue(knownFontName, out
FontFamily tbr))
411 if (NotLoadedFonts.TryGetValue(knownFontName, out
string ttfFile))
415 if (tbr.TrueTypeFile !=
null)
419 this.LoadedFonts[familyName] = tbr;
420 this.KnownFonts[familyName] = familyName;
421 this.KnownFonts[tbr.TrueTypeFile.GetFontName()] = familyName;
428 return defaultLibrary.ResolveFontFamily(fontFamily);
434 return defaultLibrary.ResolveFontFamily(fontFamily);
469 bool isStandardFamily;
473 isStandardFamily =
true;
477 isStandardFamily =
false;
480 if (isStandardFamily)
489 if (fontFamily ==
"Times-Italic" || fontFamily ==
"Times-BoldItalic" || fontFamily ==
"Helvetica-Oblique" || fontFamily ==
"Helvetica-BoldOblique" || fontFamily ==
"Courier-Oblique" || fontFamily ==
"Courier-BoldOblique")
492 tbr.
IsOblique = (fontFamily ==
"Courier-Oblique" || fontFamily ==
"Courier-BoldOblique");
Represents a font file in TrueType format. Reference: http://stevehanov.ca/blog/?id=143,...
override FontFamily ResolveFontFamily(string fontFamily)
Create a new font family from the specified family name or true type file. If the family name or the ...
SimpleFontLibrary(FontFamily timesRoman, FontFamily timesBold, FontFamily timesItalic, FontFamily timesBoldItalic, FontFamily helvetica, FontFamily helveticaBold, FontFamily helveticaOblique, FontFamily helveticaBoldOblique, FontFamily courier, FontFamily courierBold, FontFamily courierOblique, FontFamily courierBoldOblique, FontFamily symbol, FontFamily zapfdingbats)
Create a new SimpleFontLibrary instance, with the specified replacements for the standard font famili...
FontFamilyCreationException(string fontFamily)
Create a new FontFamilyCreationException instance.
void Add(string fontFamily, string fileName)
Add the font family contained in the specified True Type Font file to the library,...
A font library that can be used to cache and resolve font family names.
FontFamily ResolveFontFamily(string fontFamily, FontFamily.StandardFontFamilies finalFallback, params string[] fallback)
Create a new font family from the specified family name or true type file. If the family name or the ...
virtual FontFamily ResolveFontFamily(string fontFamily, params string[] fallback)
Create a new font family from the specified family name or true type file. If the family name or the ...
bool IsItalic
Whether this font is italic or oblique or not. This is set based on the information included in the O...
FontFamily ResolveFontFamily(FontFamily.StandardFontFamilies standardFontFamily)
Create a new font family from the specified standard font family name.
static IFontLibrary DefaultFontLibrary
The default font library used to resolve font family names.
Represents a font library with methods to create FontFamily objects from a string or from FontFamily....
bool IsStandardFamily
Whether this is one of the 14 standard font families or not.
SimpleFontLibrary()
Create a new SimpleFontLibrary instance, using the default font library to resolve the standard font ...
An exception that occurs while creating a FontFamily.
FontFamily ResolveFontFamily(string fontFamily, params string[] fallback)
Create a new font family from the specified family name or true type file. If the family name or the ...
FontFamily ResolveFontFamily(string fontFamily)
Create a new font family from the specified family name or true type file. If the family name or the ...
override FontFamily ResolveFontFamily(FontFamily.StandardFontFamilies standardFontFamily)
Create a new font family from the specified standard font family name.
static FontFamily ResolveFontFamily(string fontFamily)
Create a new font family from the specified family name or true type file. If the family name or the ...
SimpleFontLibrary(string timesRoman, string timesBold, string timesItalic, string timesBoldItalic, string helvetica, string helveticaBold, string helveticaOblique, string helveticaBoldOblique, string courier, string courierBold, string courierOblique, string courierBoldOblique, string symbol, string zapfdingbats)
Create a new SimpleFontLibrary instance, with the specified replacements for the standard font famili...
static string[] StandardFontFamilyResources
The names of the resource streams pointing to the included TrueType font files for each of the standa...
void Add(string fontFamilyName, FontFamily fontFamily)
Add the specified font family to the library with the specified name.
abstract FontFamily ResolveFontFamily(string fontFamily)
Create a new font family from the specified family name or true type file. If the family name or the ...
SimpleFontLibrary(IFontLibrary standardFontLibrary)
Create a new SimpleFontLibrary instance.
string FamilyName
Name of the font family, including any variantes.
A default font library that resolves standard families using the embedded fonts.
bool IsOblique
Whether this font is oblique or not. This is set based on the information included in the OS/2 table ...
virtual FontFamily ResolveFontFamily(string fontFamily, FontFamily.StandardFontFamilies finalFallback, params string[] fallback)
Create a new font family from the specified family name or true type file. If the family name or the ...
string GetFullFontFamilyName()
Obtains the full font family name from the TrueType file.
StandardFontFamilies
The 14 standard font families.
static string[] StandardFamilies
The names of the 14 standard families that are guaranteed to be displayed correctly.
string GetFontName()
Obtains the PostScript font name from the TrueType file.
abstract FontFamily ResolveFontFamily(FontFamily.StandardFontFamilies standardFontFamily)
Create a new font family from the specified standard font family name.
void Add(string fileName)
Add the font family contained in the specified True Type Font file to the library.
Abstract class with a default implementation of font family fallbacks.
override FontFamily ResolveFontFamily(string fontFamily)
Create a new font family from the specified family name or true type file. If the family name or the ...
override FontFamily ResolveFontFamily(FontFamily.StandardFontFamilies standardFontFamily)
Create a new font family from the specified standard font family name.
void Add(FontFamily fontFamily)
Add the specified font family to the library.
string GetFontFamilyName()
Obtains the font family name from the TrueType file.
TrueTypeFile TrueTypeFile
Parsed TrueType font file for this font family. See also: VectSharp.TrueTypeFile.
string FileName
Full path to the TrueType font file for this font family (or, if this is a standard font family,...