protected override void GetGlyphPosImpl(ActualFont actualFont, char[] buffer, int startAt, int len, Fonts.ProperGlyph[] properGlyphs) { NativeFont nativeFont = actualFont as NativeFont; if (nativeFont == null) { nativeFont = ResolveForNativeFont(actualFont); } unsafe { fixed (ProperGlyph* propGlyphH = &properGlyphs[0]) fixed (char* head = &buffer[0]) { //we use font shaping engine here NativeMyFontsLib.MyFtShaping( nativeFont.NativeFontFace.HBFont, head, buffer.Length, propGlyphH); } } }
NativeFont ResolveForNativeFont(ActualFont actualFont) { NativeFont nativeFont; FontFace fontface = actualFont.FontFace; FontKey key = new FontKey(fontface.Name, actualFont.SizeInPoints, FontStyle.Regular); if (specificFontSize.TryGetValue(key, out nativeFont)) { return nativeFont; } //----------------------------- //not native font //if we need to use hardbuzz then //create a native one for use FontFace nativeFontFace; if (!nativeFontFaces.TryGetValue(fontface.Name, out nativeFontFace)) { //create new nativeFontFace = FreeTypeFontLoader.LoadFont(fontface.FontPath, "en", HBDirection.HB_DIRECTION_LTR); nativeFontFaces.Add(fontface.Name, nativeFontFace); } //check if we have native fontface for this font? nativeFont = (NativeFont)nativeFontFace.GetFontAtPointsSize(actualFont.SizeInPoints); specificFontSize.Add(key, nativeFont); return nativeFont; }
internal TextureFont(TextureFontFace typeface, float sizeInPoints) { this.typeface = typeface; this.fontAtlas = typeface.FontAtlas; actualFont = typeface.InnerFontFace.GetFontAtPointsSize(sizeInPoints); }
public static void GetGlyphPos(ActualFont actualFont, char[] buffer, int startAt, int len, ProperGlyph[] properGlyphs) { defaultSharpingService.GetGlyphPosImpl(actualFont, buffer, startAt, len, properGlyphs); }
protected abstract void GetGlyphPosImpl(ActualFont actualFont, char[] buffer, int startAt, int len, ProperGlyph[] properGlyphs);
protected static void SetCacheActualFont(RequestFont r, ActualFont a) { RequestFont.SetCacheActualFont(r, a); }
public static void SetCacheActualFont(RequestFont r, ActualFont a) { s_actualFonts[r.FontKey] = a; //throw new NotSupportedException(); //RequestFont.SetCacheActualFont(r, a); }
protected static void SetCacheActualFont(RequestFont r, ActualFont a) { CacheFont.SetCacheActualFont(r, a); //throw new NotSupportedException(); //RequestFont.SetCacheActualFont(r, a); }
internal static void SetCacheActualFont(RequestFont r, ActualFont f) { r._actualFont = f; }
internal TextureFont(TextureFontFace typeface, float sizeInPoints) { this.typeface = typeface; this.fontAtlas = typeface.FontAtlas; actualFont = typeface.InnerFontFace.GetFontAtPointsSize(sizeInPoints); }
protected override void GetGlyphPosImpl(ActualFont actualFont, char[] buffer, int startAt, int len, ProperGlyph[] properGlyphs) { //do shaping and set text layout }
protected static void SetCacheActualFont(RequestFont r, ActualFont a) { RequestFont.SetCacheActualFont(r, a); }
public static void GetGlyphPos(ActualFont actualFont, char[] buffer, int startAt, int len, GlyphPlanList properGlyphs) { defaultSharpingService.GetGlyphPosImpl(actualFont, buffer, startAt, len, properGlyphs); }
protected abstract void GetGlyphPosImpl(ActualFont actualFont, char[] buffer, int startAt, int len, GlyphPlanList properGlyphs);