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