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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 class GlyphBuffer; | 49 class GlyphBuffer; |
50 class SimpleFontData; | 50 class SimpleFontData; |
51 | 51 |
52 class HarfBuzzShaper final { | 52 class HarfBuzzShaper final { |
53 public: | 53 public: |
54 enum ForTextEmphasisOrNot { | 54 enum ForTextEmphasisOrNot { |
55 NotForTextEmphasis, | 55 NotForTextEmphasis, |
56 ForTextEmphasis | 56 ForTextEmphasis |
57 }; | 57 }; |
58 | 58 |
59 HarfBuzzShaper(const Font*, const TextRun&, ForTextEmphasisOrNot = NotForTex
tEmphasis, HashSet<const SimpleFontData*>* fallbackFonts = 0); | 59 HarfBuzzShaper(const Font*, const TextRun&, ForTextEmphasisOrNot = NotForTex
tEmphasis, HashSet<const SimpleFontData*>* fallbackFonts = 0, FloatRect* = 0); |
60 | 60 |
61 void setDrawRange(int from, int to); | 61 void setDrawRange(int from, int to); |
62 bool shape(GlyphBuffer* = 0); | 62 bool shape(GlyphBuffer* = 0); |
63 float totalWidth() { return m_totalWidth; } | 63 float totalWidth() { return m_totalWidth; } |
64 int offsetForPosition(float targetX); | 64 int offsetForPosition(float targetX); |
65 FloatRect selectionRect(const FloatPoint&, int height, int from, int to); | 65 FloatRect selectionRect(const FloatPoint&, int height, int from, int to); |
66 const FloatRect& glyphBoundingBox() const { return m_glyphBoundingBox; } | |
67 | 66 |
68 private: | 67 private: |
69 class HarfBuzzRun { | 68 class HarfBuzzRun { |
70 public: | 69 public: |
71 HarfBuzzRun(const HarfBuzzRun&); | 70 HarfBuzzRun(const HarfBuzzRun&); |
72 ~HarfBuzzRun(); | 71 ~HarfBuzzRun(); |
73 | 72 |
74 static PassOwnPtr<HarfBuzzRun> create(const SimpleFontData* fontData, un
signed startIndex, unsigned numCharacters, hb_direction_t direction, hb_script_t
script) | 73 static PassOwnPtr<HarfBuzzRun> create(const SimpleFontData* fontData, un
signed startIndex, unsigned numCharacters, hb_direction_t direction, hb_script_t
script) |
75 { | 74 { |
76 return adoptPtr(new HarfBuzzRun(fontData, startIndex, numCharacters,
direction, script)); | 75 return adoptPtr(new HarfBuzzRun(fontData, startIndex, numCharacters,
direction, script)); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 143 |
145 Vector<hb_feature_t, 4> m_features; | 144 Vector<hb_feature_t, 4> m_features; |
146 Vector<OwnPtr<HarfBuzzRun>, 16> m_harfBuzzRuns; | 145 Vector<OwnPtr<HarfBuzzRun>, 16> m_harfBuzzRuns; |
147 | 146 |
148 int m_fromIndex; | 147 int m_fromIndex; |
149 int m_toIndex; | 148 int m_toIndex; |
150 | 149 |
151 ForTextEmphasisOrNot m_forTextEmphasis; | 150 ForTextEmphasisOrNot m_forTextEmphasis; |
152 | 151 |
153 float m_totalWidth; | 152 float m_totalWidth; |
154 FloatRect m_glyphBoundingBox; | 153 FloatRect* m_glyphBoundingBox; |
155 HashSet<const SimpleFontData*>* m_fallbackFonts; | 154 HashSet<const SimpleFontData*>* m_fallbackFonts; |
156 | 155 |
157 friend struct CachedShapingResults; | 156 friend struct CachedShapingResults; |
158 }; | 157 }; |
159 | 158 |
160 } // namespace blink | 159 } // namespace blink |
161 | 160 |
162 #endif // HarfBuzzShaper_h | 161 #endif // HarfBuzzShaper_h |
OLD | NEW |