Android Font

FontSet

1.FontCache.cpp

  1. FontPlatformData* FontCache::getCachedFontPlatformData(  
  2.      const FontDescription& fontDescription,   
  3.      const AtomicString& familyName,  
  4.       bool checkingAlternateName)  
  5. {...  
  6.  result = createFontPlatformData(fontDescription, familyName);  
  7.   
  8.  ....  
  9. }  

2.FontCacheAndroid.cpp

  1. FontPlatformData* FontCache::createFontPlatformData(const FontDescription&  
  2.    fontDescription, const AtomicString& family)  
  3. {  
  4.     ....  
  5.     if (family.length()) {  
  6.         storage = AtomicStringToUTF8String(family);  
  7.         name = storage;  
  8.     } else  
  9.         name = getFallbackFontName(fontDescription);  
  10.   
  11.     int style = SkTypeface::kNormal;  
  12.     if (fontDescription.weight() >= FontWeightBold)  
  13.         style |= SkTypeface::kBold;  
  14.     if (fontDescription.italic())  
  15.         style |= SkTypeface::kItalic;  
  16.     ....  
  17. }  

3. FontPlatformDataAndroid.cpp

  1. FontPlatformData::FontPlatformData(SkTypeface* tf, float textSize,  
  2.      bool fakeBold, bool fakeItalic)  
  3.     : mTypeface(tf), mTextSize(textSize), mFakeBold(fakeBold),  
  4.        mFakeItalic(fakeItalic)  
  5. {  
  6.     if (hashTableDeletedFontValue() != mTypeface) {  
  7.         SkSafeRef(mTypeface);  
  8.     }  
  9.   
  10.     inc_count();  
  11.     trace(3);  
  12. }  


so the bold info is in the FontPlatformData.

 

font draw

1.FontAndroid.cpp

  1. void Font::drawGlyphs(GraphicsContext* gc, const SimpleFontData* font,  
  2.                       const GlyphBuffer& glyphBuffer,  int from, int numGlyphs,  
  3.                       const FloatPoint& point) const  
  4. {  
  5.     ...  
  6.     if (!setupForText(&paint, gc, font)) {  
  7.        return;  
  8.     }  
  9.     ...  
  10.     canvas->drawPosText(glyphs, numGlyphs * sizeof(uint16_t), pos, paint);  
  11.   
  12. }  

2 .SkCanvas.cpp

  1. void SkCanvas::drawPosText(const void* text, size_t byteLength,  
  2.                            const SkPoint pos[], const SkPaint& paint) {  
  3.     ....  
  4. }  


 Android draw from render to glear

for android from InlineTextBox to skia
1.InlineTextBox.cpp paint
2.InlineTextBox.cpp paintTextWithShadows
3.GraphicsContext.cpp drawText
4.Font.cpp void Font::drawText
5.FontFastPath.cpp drawSimpleText
6.FontFastPath.cpp drawGlyphBuffer
7.FontAndroid.cpp drawGlyphs

 from skia to platform graphic 

1.SkCanvas.drawPosText.

SkCanvas has many such DrawXXX functions.

2.SkDevice.drawPosText

SkDevice also has many such DrawXXX functions as above.

3.SkPaint .drawPosText

SkPaint has many such DrawXXX functions as above

4.SkDraw.drawPosText

5.SkDraw1Glyph::Proc  proc=d1g.init(this, blitter.get(), cache). 

proc(d1g, fx, fy, glyph);

6.

SkDraw1Glyph::Proc SkDraw1Glyph::init()

it's definition is in SkDraw.cpp init()

so proc will be "D1G_NoBounder_RectClip" or "D1G_NoBounder_RgnClip" or "D1G_Bounder".

7?

how to call the platform's graphic? i havn't found out.

posted @ 2012-04-06 21:52  cascais  阅读(958)  评论(0编辑  收藏  举报