private FontFamily InstallInternal(Stream fontStream, CultureInfo culture, out FontDescription fontDescription) { var instance = FontInstance.LoadFont(fontStream); fontDescription = instance.Description; return(this.Install(instance, culture)); }
/// <summary> /// Installs the specified font stream. /// </summary> /// <param name="fontStream">The font stream.</param> /// <param name="fontDescription">The font description of the installed font.</param> /// <returns>the description of the font just loaded.</returns> public FontFamily Install(Stream fontStream, out FontDescription fontDescription) { FontInstance instance = FontInstance.LoadFont(fontStream); fontDescription = instance.Description; return(this.Install(instance)); }
internal GlyphInstance(FontInstance font, GlyphVector vector, ushort advanceWidth, short leftSideBearing, ushort sizeOfEm, ushort index, GlyphType glyphType = GlyphType.Standard, GlyphColor?glyphColor = null) { this.Font = font; this.SizeOfEm = sizeOfEm; this.vector = vector; this.AdvanceWidth = advanceWidth; this.Index = index; this.Height = sizeOfEm - this.Bounds.Min.Y; this.GlyphType = glyphType; this.LeftSideBearing = leftSideBearing; this.ScaleFactor = this.SizeOfEm * 72F; this.GlyphColor = glyphColor; }
internal GlyphInstance(FontInstance font, Vector2[] controlPoints, bool[] onCurves, ushort[] endPoints, Bounds bounds, ushort advanceWidth, short leftSideBearing, ushort sizeOfEm, ushort index) { this.Font = font; this.sizeOfEm = sizeOfEm; this.controlPoints = controlPoints; this.onCurves = onCurves; this.endPoints = endPoints; this.Bounds = bounds; this.AdvanceWidth = advanceWidth; this.Index = index; this.Height = sizeOfEm - this.Bounds.Min.Y; this.leftSideBearing = leftSideBearing; this.scaleFactor = (float)(this.sizeOfEm * 72f); }
/// <summary> /// Reads a <see cref="FontInstance"/> from the specified stream. /// </summary> /// <param name="stream">The stream.</param> /// <returns>a <see cref="FontInstance"/>.</returns> public static FontInstance[] LoadFontCollection(Stream stream) { long startPos = stream.Position; var reader = new BinaryReader(stream, true); var ttcHeader = TtcHeader.Read(reader); var fonts = new FontInstance[(int)ttcHeader.NumFonts]; for (int i = 0; i < ttcHeader.NumFonts; ++i) { stream.Position = startPos + ttcHeader.OffsetTable[i]; fonts[i] = FontInstance.LoadFont(stream); } return(fonts); }
private IEnumerable <FontFamily> InstallCollectionInternal(Stream fontCollectionStream, CultureInfo culture, out IEnumerable <FontDescription> fontDescriptions) { long startPos = fontCollectionStream.Position; var reader = new BinaryReader(fontCollectionStream, true); var ttcHeader = TtcHeader.Read(reader); var result = new List <FontDescription>((int)ttcHeader.NumFonts); var installedFamilies = new HashSet <FontFamily>(); for (int i = 0; i < ttcHeader.NumFonts; ++i) { fontCollectionStream.Position = startPos + ttcHeader.OffsetTable[i]; var instance = FontInstance.LoadFont(fontCollectionStream); installedFamilies.Add(this.Install(instance, culture)); FontDescription fontDescription = instance.Description; result.Add(fontDescription); } fontDescriptions = result; return(installedFamilies); }
internal FileFontInstance(FontDescription description, string path, long offset) { this.Description = description; this.Path = path; this.font = new Lazy <Fonts.IFontInstance>(() => FontInstance.LoadFont(path, offset)); }
public FileFontInstance(string path) { this.Description = FontDescription.LoadDescription(path); this.font = new Lazy <Fonts.FontInstance>(() => FontInstance.LoadFont(path)); }
/// <summary> /// Installs the specified font stream. /// </summary> /// <param name="fontStream">The font stream.</param> /// <returns>the description of the font just loaded.</returns> public FontFamily Install(Stream fontStream) { FontInstance instance = FontInstance.LoadFont(fontStream); return(this.Install(instance)); }
/// <summary> /// Installs the specified font stream. /// </summary> /// <param name="fontStream">The font stream.</param> /// <returns>the description of the font just loaded.</returns> public Font Install(Stream fontStream) { var instance = FontInstance.LoadFont(fontStream); return(Install(instance)); }