OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 class PLATFORM_EXPORT ShapeResult : public RefCounted<ShapeResult> { | 54 class PLATFORM_EXPORT ShapeResult : public RefCounted<ShapeResult> { |
55 public: | 55 public: |
56 ShapeResult(): m_width(0), m_numGlyphs(0) { } | 56 ShapeResult(): m_width(0), m_numGlyphs(0) { } |
57 ~ShapeResult(); | 57 ~ShapeResult(); |
58 | 58 |
59 float width() { return m_width; } | 59 float width() { return m_width; } |
60 FloatRect bounds() { return m_glyphBoundingBox; } | 60 FloatRect bounds() { return m_glyphBoundingBox; } |
61 int offsetForPosition(float targetX); | 61 int offsetForPosition(float targetX); |
62 unsigned numCharacters() const { return m_numCharacters; } | 62 unsigned numCharacters() const { return m_numCharacters; } |
63 void fallbackFonts(HashSet<const SimpleFontData*>*) const; | 63 const HashSet<const SimpleFontData*>* fallbackFonts() const |
| 64 { |
| 65 return &m_fallbackFonts; |
| 66 } |
64 | 67 |
65 static float fillGlyphBuffer(Vector<RefPtr<ShapeResult>>&, | 68 static float fillGlyphBuffer(Vector<RefPtr<ShapeResult>>&, |
66 GlyphBuffer*, const TextRun&, unsigned from, unsigned to); | 69 GlyphBuffer*, const TextRun&, unsigned from, unsigned to); |
67 static float fillGlyphBufferForTextEmphasis(Vector<RefPtr<ShapeResult>>&, | 70 static float fillGlyphBufferForTextEmphasis(Vector<RefPtr<ShapeResult>>&, |
68 GlyphBuffer*, const TextRun&, const GlyphData* emphasisData, | 71 GlyphBuffer*, const TextRun&, const GlyphData* emphasisData, |
69 unsigned from, unsigned to); | 72 unsigned from, unsigned to); |
70 static FloatRect selectionRect(Vector<RefPtr<ShapeResult>>&, | 73 static FloatRect selectionRect(Vector<RefPtr<ShapeResult>>&, |
71 TextDirection, float totalWidth, const FloatPoint&, int height, | 74 TextDirection, float totalWidth, const FloatPoint&, int height, |
72 unsigned from, unsigned to); | 75 unsigned from, unsigned to); |
73 | 76 |
(...skipping 10 matching lines...) Expand all Loading... |
84 float fillGlyphBufferForRun(GlyphBuffer*, const RunInfo*, | 87 float fillGlyphBufferForRun(GlyphBuffer*, const RunInfo*, |
85 float initialAdvance, unsigned from, unsigned to, unsigned runOffset); | 88 float initialAdvance, unsigned from, unsigned to, unsigned runOffset); |
86 | 89 |
87 float fillGlyphBufferForTextEmphasisRun(GlyphBuffer*, const RunInfo*, | 90 float fillGlyphBufferForTextEmphasisRun(GlyphBuffer*, const RunInfo*, |
88 const TextRun&, const GlyphData*, float initialAdvance, | 91 const TextRun&, const GlyphData*, float initialAdvance, |
89 unsigned from, unsigned to, unsigned runOffset); | 92 unsigned from, unsigned to, unsigned runOffset); |
90 | 93 |
91 float m_width; | 94 float m_width; |
92 FloatRect m_glyphBoundingBox; | 95 FloatRect m_glyphBoundingBox; |
93 Vector<RunInfo*> m_runs; | 96 Vector<RunInfo*> m_runs; |
94 const SimpleFontData* m_primaryFont; | 97 HashSet<const SimpleFontData*> m_fallbackFonts; |
95 | 98 |
96 unsigned m_numCharacters; | 99 unsigned m_numCharacters; |
97 unsigned m_numGlyphs : 31; | 100 unsigned m_numGlyphs : 31; |
98 | 101 |
99 // Overall direction for the TextRun, dictates which order each individual | 102 // Overall direction for the TextRun, dictates which order each individual |
100 // sub run (represented by RunInfo structs in the m_runs vector) can have a | 103 // sub run (represented by RunInfo structs in the m_runs vector) can have a |
101 // different text direction. | 104 // different text direction. |
102 unsigned m_direction : 1; | 105 unsigned m_direction : 1; |
103 | 106 |
104 friend class HarfBuzzShaper; | 107 friend class HarfBuzzShaper; |
105 }; | 108 }; |
106 | 109 |
107 class PLATFORM_EXPORT HarfBuzzShaper final : public Shaper { | 110 class PLATFORM_EXPORT HarfBuzzShaper final : public Shaper { |
108 public: | 111 public: |
109 HarfBuzzShaper(const Font*, const TextRun&); | 112 HarfBuzzShaper(const Font*, const TextRun&, |
| 113 HashSet<const SimpleFontData*>* fallbackFonts); |
110 PassRefPtr<ShapeResult> shapeResult(); | 114 PassRefPtr<ShapeResult> shapeResult(); |
111 ~HarfBuzzShaper() { } | 115 ~HarfBuzzShaper() { } |
112 | 116 |
113 private: | 117 private: |
114 class PLATFORM_EXPORT HarfBuzzRun { | 118 class PLATFORM_EXPORT HarfBuzzRun { |
115 public: | 119 public: |
116 HarfBuzzRun(const HarfBuzzRun&); | 120 HarfBuzzRun(const HarfBuzzRun&); |
117 ~HarfBuzzRun(); | 121 ~HarfBuzzRun(); |
118 | 122 |
119 static PassOwnPtr<HarfBuzzRun> create(const SimpleFontData* fontData, un
signed startIndex, unsigned numCharacters, hb_direction_t direction, hb_script_t
script) | 123 static PassOwnPtr<HarfBuzzRun> create(const SimpleFontData* fontData, un
signed startIndex, unsigned numCharacters, hb_direction_t direction, hb_script_t
script) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 float m_letterSpacing; // Pixels to be added after each glyph. | 160 float m_letterSpacing; // Pixels to be added after each glyph. |
157 unsigned m_expansionOpportunityCount; | 161 unsigned m_expansionOpportunityCount; |
158 | 162 |
159 Vector<hb_feature_t, 4> m_features; | 163 Vector<hb_feature_t, 4> m_features; |
160 Vector<OwnPtr<HarfBuzzRun>, 16> m_harfBuzzRuns; | 164 Vector<OwnPtr<HarfBuzzRun>, 16> m_harfBuzzRuns; |
161 }; | 165 }; |
162 | 166 |
163 } // namespace blink | 167 } // namespace blink |
164 | 168 |
165 #endif // HarfBuzzShaper_h | 169 #endif // HarfBuzzShaper_h |
OLD | NEW |