のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

FontPlatformData.h

class TextRunWalker {
    422 public:
    423 
    494 private:
    512     const Font* const m_font;
    513     HB_ShaperItem m_item;
    514     uint16_t* m_glyphs16; // A vector of 16-bit glyph ids.
    515     SkPoint* m_positions; // A vector of positions for each glyph.
    516     ssize_t m_indexOfNextScriptRun; // Indexes the script run in |m_run|.
    517     const int m_startingX; // Offset in pixels of the first script run.
    518     const int m_startingY; // Offset in pixels of the first script run.
    519     int m_offsetX; // Offset in pixels to the start of the next script run.
    520     unsigned m_pixelWidth; // Width (in px) of the current script run.
    521     unsigned m_numCodePoints; // Code points in current script run.
    522     unsigned m_glyphsArrayCapacity; // Current size of all the Harfbuzz arrays.
    523 
    524     OwnPtr<TextRun> m_normalizedRun;
    525     OwnArrayPtr<UChar> m_normalizedBuffer; // A buffer for normalized run.
    526     const TextRun& m_run;
    527     bool m_iterateBackwards;
    528     int m_wordSpacingAdjustment; // delta adjustment (pixels) for each word break.
    529     float m_padding; // pixels to be distributed over the line at word breaks.
    530     float m_padPerWordBreak; // pixels to be added to each word break.
    531     float m_padError; // |m_padPerWordBreak| might have a fractional component.
    532                       // Since we only add a whole number of padding pixels at
    533                       // each word break we accumulate error. This is the
    534                       // number of pixels that we are behind so far.
    535     unsigned m_letterSpacing; // pixels to be added after each glyph.
    536 };
class Font {
     77 public:
    236 private:
    237     bool loadingCustomFonts() const
    238     {
    239         return m_fontList && m_fontList->loadingCustomFonts();
    240     }
    241 
    242     FontDescription m_fontDescription;
    243     mutable RefPtr<FontFallbackList> m_fontList;
    244     short m_letterSpacing;
    245     short m_wordSpacing;
    246     bool m_isPlatformFont;
    247     bool m_needsTranscoding;
    248 };
     40 class FontFallbackList : public RefCounted<FontFallbackList> {
     41 public:
     54 
     55 private:
     73     mutable Vector<pair<const FontData*, bool>, 1> m_fontList;
     74     mutable HashMap<int, GlyphPageTreeNode*>       m_pages;
     75     mutable GlyphPageTreeNode*                     m_pageZero;
     76     mutable const SimpleFontData*                  m_cachedPrimarySimpleFontData;
     77     RefPtr<FontSelector>                           m_fontSelector;
     78     mutable int                                    m_familyIndex;
     79     mutable Pitch                                  m_pitch;
     80     mutable bool                                   m_loadingCustomFonts;
     81     unsigned                                       m_generation;
     82 
     83     friend class Font;     
     84 };
     53 class FontCache {
     54     WTF_MAKE_NONCOPYABLE(FontCache); WTF_MAKE_FAST_ALLOCATED;
     55 public:
     96 private:
    109     friend class SimpleFontData; // For getCachedFontData(const FontPlatformData*)
    110     friend class FontFallbackList;
    111 };
    112 
     72 class SimpleFontData : public FontData {
     73 public:
    186 private:
    206     FontMetrics m_fontMetrics;
    207     float m_maxCharWidth;
    208     float m_avgCharWidth;
    209 
    210     FontPlatformData m_platformData;
    211 
    212     mutable OwnPtr<GlyphMetricsMap<FloatRect> > m_glyphToBoundsMap;
    213     mutable GlyphMetricsMap<float> m_glyphToWidthMap;
    214 
    215     bool m_treatAsFixedPitch;
    216 
    217 #if ENABLE(SVG_FONTS)
    218     OwnPtr<SVGFontData> m_svgFontData;
    219 #endif
    220 
    221     bool m_isCustomFont;  // Whether or not we are custom font loaded via @font-face
    222     bool m_isLoading; // Whether or not this custom font is still in the act of loading.
    223 
    224     bool m_isTextOrientationFallback;
    225     bool m_isBrokenIdeographFallback;
    226     bool m_hasVerticalGlyphs;
    227 
    228     Glyph m_spaceGlyph;
    229     float m_spaceWidth;
    230 
    231     Glyph m_zeroWidthSpaceGlyph;
    232 
    233     GlyphData m_missingGlyphData;
    234 
    253     mutable OwnPtr<DerivedFontData> m_derivedFontData;
    287 };
    288
     49 class FontPlatformData {
     50 public:
    101 private:
    121     SkTypeface* m_typeface;
    122     float       m_textSize;
    123     mutable int m_emSizeInFontUnits;
    124     bool        m_fakeBold;
    125     bool        m_fakeItalic;
    126     FontOrientation m_orientation;
    127     TextOrientation m_textOrientation;
    128     mutable RefPtr<RefCountedHarfbuzzFace> m_harfbuzzFace;
    129     static SkLanguage s_defaultLanguage;
     31 class SK_API SkTypeface : public SkRefCnt {
     32 public:
     33     /** Style specifies the intrinsic style attributes of a given typeface
     34     */
     35     enum Style {
     36         kNormal = 0,
     37         kBold   = 0x01,
     38         kItalic = 0x02,
     39 
     40         // helpers
     41         kBoldItalic = 0x03
     42     };
    155 private:
    156     SkFontID    fUniqueID;
    157     Style       fStyle;
    158     bool        fIsFixedWidth;
    159 
    160     typedef SkRefCnt INHERITED;
    161 };
     53 class FontDescription {
     54 public:
     55     enum GenericFamilyType { NoFamily, StandardFamily, SerifFamily, SansSerifFamily,
     56                              MonospaceFamily, CursiveFamily, FantasyFamily };
     57 
    129 private:
    130     FontFamily m_familyList; // The list of font families to be used.
    131 
    132     float m_specifiedSize;   // Specified CSS value. Independent of rendering issues such as integer
    133                              // rounding, minimum font sizes, and zooming.
    134     float m_computedSize;    // Computed size adjusted for the minimum font size and the zoom factor.
    135 
    136     FontOrientation m_orientation; // Whether the font is rendering on a horizontal line or a vertical line.
    137     TextOrientation m_textOrientation; // Only used by vertical text. Determines the default orientation for non-ideograph glyphs.
    138 
    139     FontWidthVariant m_widthVariant;
    140 
    141     bool m_italic : 1;
    142     bool m_smallCaps : 1;
    143     bool m_isAbsoluteSize : 1;   // Whether or not CSS specified an explicit size
    144                                  // (logical sizes like "medium" don't count).
    145     unsigned m_weight : 8; // FontWeight
    146     unsigned m_genericFamily : 3; // GenericFamilyType
    147     bool m_usePrinterFont : 1;
    148 
    149     unsigned m_renderingMode : 1;  // Used to switch between CG and GDI text on Windows.
    150 
    151     unsigned m_keywordSize : 4; // We cache whether or not a font is currently represented by a CSS keyword (e.g., medium).  If so,
    152                            // then we can accurately translate across different generic families to adjust for different preference settings
    153                            // (e.g., 13px monospace vs. 16px everything else).  Sizes are 1-8 (like the HTML size values for <font>).
    154 
    155     unsigned m_fontSmoothing : 2; // FontSmoothingMode
    156     unsigned m_textRendering : 2; // TextRenderingMode
    157     bool m_isSpecifiedFont : 1; // True if a web page specifies a non-generic font family as the first font family.
    158 };
     37 class FontFamily {
     38 public:
     52 private:
     53     AtomicString m_family;                  <=====
     54     ListRefPtr<SharedFontFamily> m_next;    <=====
     55 };
     56