specific fontface + size + style
Inheritance: IDisposable
        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;
        }
Beispiel #3
0
        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);
Beispiel #6
0
 protected static void SetCacheActualFont(RequestFont r, ActualFont a)
 {
     RequestFont.SetCacheActualFont(r, a);
 }
Beispiel #7
0
 public static void SetCacheActualFont(RequestFont r, ActualFont a)
 {
     s_actualFonts[r.FontKey] = a;
     //throw new NotSupportedException();
     //RequestFont.SetCacheActualFont(r, a);
 }
Beispiel #8
0
 protected static void SetCacheActualFont(RequestFont r, ActualFont a)
 {
     CacheFont.SetCacheActualFont(r, a);
     //throw new NotSupportedException();
     //RequestFont.SetCacheActualFont(r, a);
 }
Beispiel #9
0
 internal static void SetCacheActualFont(RequestFont r, ActualFont f)
 {
     r._actualFont = f;
 }
Beispiel #10
0
 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
 }
Beispiel #12
0
 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);