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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 public: | 55 public: |
56 static PassRefPtr<ShapeResult> create(const Font* font, | 56 static PassRefPtr<ShapeResult> create(const Font* font, |
57 unsigned numCharacters, TextDirection direction) | 57 unsigned numCharacters, TextDirection direction) |
58 { | 58 { |
59 return adoptRef(new ShapeResult(font, numCharacters, direction)); | 59 return adoptRef(new ShapeResult(font, numCharacters, direction)); |
60 } | 60 } |
61 ~ShapeResult(); | 61 ~ShapeResult(); |
62 | 62 |
63 float width() { return m_width; } | 63 float width() { return m_width; } |
64 FloatRect bounds() { return m_glyphBoundingBox; } | 64 FloatRect bounds() { return m_glyphBoundingBox; } |
65 int offsetForPosition(float targetX); | |
66 unsigned numCharacters() const { return m_numCharacters; } | 65 unsigned numCharacters() const { return m_numCharacters; } |
67 void fallbackFonts(HashSet<const SimpleFontData*>*) const; | 66 void fallbackFonts(HashSet<const SimpleFontData*>*) const; |
68 | 67 |
| 68 static int offsetForPosition(Vector<RefPtr<ShapeResult>>&, |
| 69 const TextRun&, float targetX); |
69 static float fillGlyphBuffer(Vector<RefPtr<ShapeResult>>&, | 70 static float fillGlyphBuffer(Vector<RefPtr<ShapeResult>>&, |
70 GlyphBuffer*, const TextRun&, unsigned from, unsigned to); | 71 GlyphBuffer*, const TextRun&, unsigned from, unsigned to); |
71 static float fillGlyphBufferForTextEmphasis(Vector<RefPtr<ShapeResult>>&, | 72 static float fillGlyphBufferForTextEmphasis(Vector<RefPtr<ShapeResult>>&, |
72 GlyphBuffer*, const TextRun&, const GlyphData* emphasisData, | 73 GlyphBuffer*, const TextRun&, const GlyphData* emphasisData, |
73 unsigned from, unsigned to); | 74 unsigned from, unsigned to); |
74 static FloatRect selectionRect(Vector<RefPtr<ShapeResult>>&, | 75 static FloatRect selectionRect(Vector<RefPtr<ShapeResult>>&, |
75 TextDirection, float totalWidth, const FloatPoint&, int height, | 76 TextDirection, float totalWidth, const FloatPoint&, int height, |
76 unsigned from, unsigned to); | 77 unsigned from, unsigned to); |
77 | 78 |
78 unsigned numberOfRunsForTesting() const; | 79 unsigned numberOfRunsForTesting() const; |
79 bool runInfoForTesting(unsigned runIndex, unsigned& startIndex, | 80 bool runInfoForTesting(unsigned runIndex, unsigned& startIndex, |
80 unsigned& numGlyphs, hb_script_t&); | 81 unsigned& numGlyphs, hb_script_t&); |
81 uint16_t glyphForTesting(unsigned runIndex, size_t glyphIndex); | 82 uint16_t glyphForTesting(unsigned runIndex, size_t glyphIndex); |
82 float advanceForTesting(unsigned runIndex, size_t glyphIndex); | 83 float advanceForTesting(unsigned runIndex, size_t glyphIndex); |
83 | 84 |
84 private: | 85 private: |
85 struct RunInfo; | 86 struct RunInfo; |
86 | 87 |
87 ShapeResult(const Font*, unsigned numCharacters, TextDirection); | 88 ShapeResult(const Font*, unsigned numCharacters, TextDirection); |
88 | 89 |
| 90 int offsetForPosition(float targetX); |
89 template<TextDirection> | 91 template<TextDirection> |
90 float fillGlyphBufferForRun(GlyphBuffer*, const RunInfo*, | 92 float fillGlyphBufferForRun(GlyphBuffer*, const RunInfo*, |
91 float initialAdvance, unsigned from, unsigned to, unsigned runOffset); | 93 float initialAdvance, unsigned from, unsigned to, unsigned runOffset); |
92 | 94 |
93 float fillGlyphBufferForTextEmphasisRun(GlyphBuffer*, const RunInfo*, | 95 float fillGlyphBufferForTextEmphasisRun(GlyphBuffer*, const RunInfo*, |
94 const TextRun&, const GlyphData*, float initialAdvance, | 96 const TextRun&, const GlyphData*, float initialAdvance, |
95 unsigned from, unsigned to, unsigned runOffset); | 97 unsigned from, unsigned to, unsigned runOffset); |
96 | 98 |
97 float m_width; | 99 float m_width; |
98 FloatRect m_glyphBoundingBox; | 100 FloatRect m_glyphBoundingBox; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 float m_letterSpacing; // Pixels to be added after each glyph. | 145 float m_letterSpacing; // Pixels to be added after each glyph. |
144 unsigned m_expansionOpportunityCount; | 146 unsigned m_expansionOpportunityCount; |
145 | 147 |
146 Vector<hb_feature_t, 4> m_features; | 148 Vector<hb_feature_t, 4> m_features; |
147 Vector<HarfBuzzRun, 16> m_harfBuzzRuns; | 149 Vector<HarfBuzzRun, 16> m_harfBuzzRuns; |
148 }; | 150 }; |
149 | 151 |
150 } // namespace blink | 152 } // namespace blink |
151 | 153 |
152 #endif // HarfBuzzShaper_h | 154 #endif // HarfBuzzShaper_h |
OLD | NEW |