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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 static PassRefPtr<ShapeResult> create(unsigned numCharacters, TextDirection
direction) | 56 static PassRefPtr<ShapeResult> create(unsigned numCharacters, TextDirection
direction) |
57 { | 57 { |
58 return adoptRef(new ShapeResult(numCharacters, direction)); | 58 return adoptRef(new ShapeResult(numCharacters, direction)); |
59 } | 59 } |
60 ~ShapeResult(); | 60 ~ShapeResult(); |
61 | 61 |
62 float width() { return m_width; } | 62 float width() { return m_width; } |
63 FloatRect bounds() { return m_glyphBoundingBox; } | 63 FloatRect bounds() { return m_glyphBoundingBox; } |
64 int offsetForPosition(float targetX); | 64 int offsetForPosition(float targetX); |
65 unsigned numCharacters() const { return m_numCharacters; } | 65 unsigned numCharacters() const { return m_numCharacters; } |
66 void fallbackFonts(HashSet<const SimpleFontData*>*) const; | 66 const HashSet<const SimpleFontData*>* fallbackFonts() const |
| 67 { |
| 68 return &m_fallbackFonts; |
| 69 } |
67 | 70 |
68 static float fillGlyphBuffer(Vector<RefPtr<ShapeResult>>&, | 71 static float fillGlyphBuffer(Vector<RefPtr<ShapeResult>>&, |
69 GlyphBuffer*, const TextRun&, unsigned from, unsigned to); | 72 GlyphBuffer*, const TextRun&, unsigned from, unsigned to); |
70 static float fillGlyphBufferForTextEmphasis(Vector<RefPtr<ShapeResult>>&, | 73 static float fillGlyphBufferForTextEmphasis(Vector<RefPtr<ShapeResult>>&, |
71 GlyphBuffer*, const TextRun&, const GlyphData* emphasisData, | 74 GlyphBuffer*, const TextRun&, const GlyphData* emphasisData, |
72 unsigned from, unsigned to); | 75 unsigned from, unsigned to); |
73 static FloatRect selectionRect(Vector<RefPtr<ShapeResult>>&, | 76 static FloatRect selectionRect(Vector<RefPtr<ShapeResult>>&, |
74 TextDirection, float totalWidth, const FloatPoint&, int height, | 77 TextDirection, float totalWidth, const FloatPoint&, int height, |
75 unsigned from, unsigned to); | 78 unsigned from, unsigned to); |
76 | 79 |
(...skipping 16 matching lines...) Expand all Loading... |
93 float fillGlyphBufferForRun(GlyphBuffer*, const RunInfo*, | 96 float fillGlyphBufferForRun(GlyphBuffer*, const RunInfo*, |
94 float initialAdvance, unsigned from, unsigned to, unsigned runOffset); | 97 float initialAdvance, unsigned from, unsigned to, unsigned runOffset); |
95 | 98 |
96 float fillGlyphBufferForTextEmphasisRun(GlyphBuffer*, const RunInfo*, | 99 float fillGlyphBufferForTextEmphasisRun(GlyphBuffer*, const RunInfo*, |
97 const TextRun&, const GlyphData*, float initialAdvance, | 100 const TextRun&, const GlyphData*, float initialAdvance, |
98 unsigned from, unsigned to, unsigned runOffset); | 101 unsigned from, unsigned to, unsigned runOffset); |
99 | 102 |
100 float m_width; | 103 float m_width; |
101 FloatRect m_glyphBoundingBox; | 104 FloatRect m_glyphBoundingBox; |
102 Vector<RunInfo*> m_runs; | 105 Vector<RunInfo*> m_runs; |
103 const SimpleFontData* m_primaryFont; | 106 HashSet<const SimpleFontData*> m_fallbackFonts; |
104 | 107 |
105 unsigned m_numCharacters; | 108 unsigned m_numCharacters; |
106 unsigned m_numGlyphs : 31; | 109 unsigned m_numGlyphs : 31; |
107 | 110 |
108 // Overall direction for the TextRun, dictates which order each individual | 111 // Overall direction for the TextRun, dictates which order each individual |
109 // sub run (represented by RunInfo structs in the m_runs vector) can have a | 112 // sub run (represented by RunInfo structs in the m_runs vector) can have a |
110 // different text direction. | 113 // different text direction. |
111 unsigned m_direction : 1; | 114 unsigned m_direction : 1; |
112 | 115 |
113 friend class HarfBuzzShaper; | 116 friend class HarfBuzzShaper; |
114 }; | 117 }; |
115 | 118 |
116 class PLATFORM_EXPORT HarfBuzzShaper final : public Shaper { | 119 class PLATFORM_EXPORT HarfBuzzShaper final : public Shaper { |
117 public: | 120 public: |
118 HarfBuzzShaper(const Font*, const TextRun&); | 121 HarfBuzzShaper(const Font*, const TextRun&, |
| 122 HashSet<const SimpleFontData*>* fallbackFonts); |
119 PassRefPtr<ShapeResult> shapeResult(); | 123 PassRefPtr<ShapeResult> shapeResult(); |
120 ~HarfBuzzShaper() { } | 124 ~HarfBuzzShaper() { } |
121 | 125 |
122 private: | 126 private: |
123 struct HarfBuzzRun { | 127 struct HarfBuzzRun { |
124 const SimpleFontData* m_fontData; | 128 const SimpleFontData* m_fontData; |
125 unsigned m_startIndex; | 129 unsigned m_startIndex; |
126 size_t m_numCharacters; | 130 size_t m_numCharacters; |
127 hb_direction_t m_direction; | 131 hb_direction_t m_direction; |
128 hb_script_t m_script; | 132 hb_script_t m_script; |
(...skipping 17 matching lines...) Expand all Loading... |
146 float m_letterSpacing; // Pixels to be added after each glyph. | 150 float m_letterSpacing; // Pixels to be added after each glyph. |
147 unsigned m_expansionOpportunityCount; | 151 unsigned m_expansionOpportunityCount; |
148 | 152 |
149 Vector<hb_feature_t, 4> m_features; | 153 Vector<hb_feature_t, 4> m_features; |
150 Vector<HarfBuzzRun, 16> m_harfBuzzRuns; | 154 Vector<HarfBuzzRun, 16> m_harfBuzzRuns; |
151 }; | 155 }; |
152 | 156 |
153 } // namespace blink | 157 } // namespace blink |
154 | 158 |
155 #endif // HarfBuzzShaper_h | 159 #endif // HarfBuzzShaper_h |
OLD | NEW |