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