OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2006, 2007, 2008, Google Inc. All rights reserved. | 2 * Copyright (c) 2006, 2007, 2008, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 21 matching lines...) Expand all Loading... |
32 #define FontPlatformDataHarfBuzz_h | 32 #define FontPlatformDataHarfBuzz_h |
33 | 33 |
34 #include "SkPaint.h" | 34 #include "SkPaint.h" |
35 #include "core/platform/SharedBuffer.h" | 35 #include "core/platform/SharedBuffer.h" |
36 #include "core/platform/graphics/FontOrientation.h" | 36 #include "core/platform/graphics/FontOrientation.h" |
37 #include "core/platform/graphics/chromium/FontRenderStyle.h" | 37 #include "core/platform/graphics/chromium/FontRenderStyle.h" |
38 #include "core/platform/graphics/opentype/OpenTypeVerticalData.h" | 38 #include "core/platform/graphics/opentype/OpenTypeVerticalData.h" |
39 #include "wtf/Forward.h" | 39 #include "wtf/Forward.h" |
40 #include "wtf/HashTableDeletedValueType.h" | 40 #include "wtf/HashTableDeletedValueType.h" |
41 #include "wtf/RefPtr.h" | 41 #include "wtf/RefPtr.h" |
| 42 #include "wtf/text/AtomicString.h" |
42 #include "wtf/text/CString.h" | 43 #include "wtf/text/CString.h" |
43 #include "wtf/text/StringImpl.h" | 44 #include "wtf/text/StringImpl.h" |
44 | 45 |
45 class SkTypeface; | 46 class SkTypeface; |
46 typedef uint32_t SkFontID; | 47 typedef uint32_t SkFontID; |
47 | 48 |
48 namespace WebCore { | 49 namespace WebCore { |
49 | 50 |
50 class FontDescription; | 51 class FontDescription; |
51 class HarfBuzzFace; | 52 class HarfBuzzFace; |
52 | 53 |
53 // ----------------------------------------------------------------------------- | 54 // ----------------------------------------------------------------------------- |
54 // FontPlatformData is the handle which WebKit has on a specific face. A face | 55 // FontPlatformData is the handle which WebKit has on a specific face. A face |
55 // is the tuple of (font, size, ...etc). Here we are just wrapping a Skia | 56 // is the tuple of (font, size, ...etc). Here we are just wrapping a Skia |
56 // SkTypeface pointer and dealing with the reference counting etc. | 57 // SkTypeface pointer and dealing with the reference counting etc. |
57 // ----------------------------------------------------------------------------- | 58 // ----------------------------------------------------------------------------- |
58 class FontPlatformData { | 59 class FontPlatformData { |
59 public: | 60 public: |
60 // Used for deleted values in the font cache's hash tables. The hash table | 61 // Used for deleted values in the font cache's hash tables. The hash table |
61 // will create us with this structure, and it will compare other values | 62 // will create us with this structure, and it will compare other values |
62 // to this "Deleted" one. It expects the Deleted one to be differentiable | 63 // to this "Deleted" one. It expects the Deleted one to be differentiable |
63 // from the 0 one (created with the empty constructor), so we can't just | 64 // from the 0 one (created with the empty constructor), so we can't just |
64 // set everything to 0. | 65 // set everything to 0. |
65 FontPlatformData(WTF::HashTableDeletedValueType); | 66 FontPlatformData(WTF::HashTableDeletedValueType); |
66 FontPlatformData(); | 67 FontPlatformData(); |
67 FontPlatformData(float textSize, bool fakeBold, bool fakeItalic); | 68 FontPlatformData(float textSize, bool fakeBold, bool fakeItalic); |
68 FontPlatformData(const FontPlatformData&); | 69 FontPlatformData(const FontPlatformData&); |
69 FontPlatformData(SkTypeface*, const char* name, float textSize, bool fakeBol
d, bool fakeItalic, FontOrientation = Horizontal); | 70 FontPlatformData(SkTypeface*, const char* name, float textSize, bool fakeBol
d, bool fakeItalic, FontOrientation = Horizontal, const AtomicString& locale = A
tomicString()); |
70 FontPlatformData(const FontPlatformData& src, float textSize); | 71 FontPlatformData(const FontPlatformData& src, float textSize); |
71 ~FontPlatformData(); | 72 ~FontPlatformData(); |
72 | 73 |
73 String fontFamilyName() const; | 74 String fontFamilyName() const; |
74 | 75 |
75 // ------------------------------------------------------------------------- | 76 // ------------------------------------------------------------------------- |
76 // Return true iff this font is monospaced (i.e. every glyph has an equal x | 77 // Return true iff this font is monospaced (i.e. every glyph has an equal x |
77 // advance) | 78 // advance) |
78 // ------------------------------------------------------------------------- | 79 // ------------------------------------------------------------------------- |
79 bool isFixedPitch() const; | 80 bool isFixedPitch() const; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 void querySystemForRenderStyle(); | 132 void querySystemForRenderStyle(); |
132 | 133 |
133 RefPtr<SkTypeface> m_typeface; | 134 RefPtr<SkTypeface> m_typeface; |
134 CString m_family; | 135 CString m_family; |
135 float m_textSize; | 136 float m_textSize; |
136 mutable int m_emSizeInFontUnits; | 137 mutable int m_emSizeInFontUnits; |
137 bool m_fakeBold; | 138 bool m_fakeBold; |
138 bool m_fakeItalic; | 139 bool m_fakeItalic; |
139 FontOrientation m_orientation; | 140 FontOrientation m_orientation; |
140 FontRenderStyle m_style; | 141 FontRenderStyle m_style; |
| 142 // Only set for platforms (e.g. Android) that FontCache::getFontDataForChara
cter() may return different FontData |
| 143 // for different locales of FontDescriptions. |
| 144 AtomicString m_locale; |
141 mutable RefPtr<HarfBuzzFace> m_harfBuzzFace; | 145 mutable RefPtr<HarfBuzzFace> m_harfBuzzFace; |
142 bool m_isHashTableDeletedValue; | 146 bool m_isHashTableDeletedValue; |
143 }; | 147 }; |
144 | 148 |
145 } // namespace WebCore | 149 } // namespace WebCore |
146 | 150 |
147 #endif // ifdef FontPlatformDataHarfBuzz_h | 151 #endif // ifdef FontPlatformDataHarfBuzz_h |
OLD | NEW |