| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010 Google Inc. All rights reserved. | 2 * Copyright (c) 2010 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 const unsigned width() const { return m_pixelWidth; } | 104 const unsigned width() const { return m_pixelWidth; } |
| 105 | 105 |
| 106 // Return the cluster log for the current script run. For example: | 106 // Return the cluster log for the current script run. For example: |
| 107 // script run: f i a n c é (fi gets ligatured) | 107 // script run: f i a n c é (fi gets ligatured) |
| 108 // log clutrs: 0 0 1 2 3 4 | 108 // log clutrs: 0 0 1 2 3 4 |
| 109 // So, for each input code point, the log tells you which output glyph was | 109 // So, for each input code point, the log tells you which output glyph was |
| 110 // generated for it. | 110 // generated for it. |
| 111 const unsigned short* logClusters() const { return m_item.log_clusters; } | 111 const unsigned short* logClusters() const { return m_item.log_clusters; } |
| 112 | 112 |
| 113 // return the number of code points in the current script run | 113 // return the number of code points in the current script run |
| 114 const unsigned numCodePoints() const { return m_numCodePoints; } | 114 const unsigned numCodePoints() const { return m_item.item.length; } |
| 115 | 115 |
| 116 // Return the current pixel position of the controller. | 116 // Return the current pixel position of the controller. |
| 117 const unsigned offsetX() const { return m_offsetX; } | 117 const unsigned offsetX() const { return m_offsetX; } |
| 118 | 118 |
| 119 const FontPlatformData* fontPlatformDataForScriptRun() { return reinterpret_
cast<FontPlatformData*>(m_item.font->userData); } | 119 const FontPlatformData* fontPlatformDataForScriptRun() { return reinterpret_
cast<FontPlatformData*>(m_item.font->userData); } |
| 120 | 120 |
| 121 private: | 121 private: |
| 122 void setupFontForScriptRun(); | 122 void setupFontForScriptRun(); |
| 123 HB_FontRec* allocHarfbuzzFont(); | 123 HB_FontRec* allocHarfbuzzFont(); |
| 124 void deleteGlyphArrays(); | 124 void deleteGlyphArrays(); |
| 125 void createGlyphArrays(int); | 125 void createGlyphArrays(int); |
| 126 void resetGlyphArrays(); | 126 void resetGlyphArrays(); |
| 127 void shapeGlyphs(); | 127 void shapeGlyphs(); |
| 128 void setGlyphXPositions(bool); | 128 void setGlyphXPositions(bool); |
| 129 | 129 |
| 130 static void normalizeSpacesAndMirrorChars(const UChar* source, bool rtl, UCh
ar* destination, int length); | 130 static void normalizeSpacesAndMirrorChars(const UChar* source, bool rtl, UCh
ar* destination, int length); |
| 131 static const TextRun& getNormalizedTextRun(const TextRun& originalRun, OwnPt
r<TextRun>& normalizedRun, OwnArrayPtr<UChar>& normalizedBuffer); | 131 static const TextRun& getNormalizedTextRun(const TextRun& originalRun, OwnPt
r<TextRun>& normalizedRun, OwnArrayPtr<UChar>& normalizedBuffer); |
| 132 | 132 |
| 133 // This matches the logic in RenderBlock::findNextLineBreak | 133 // This matches the logic in RenderBlock::findNextLineBreak |
| 134 static bool isCodepointSpace(HB_UChar16 c) { return c == ' ' || c == '\t'; } | 134 static bool isCodepointSpace(HB_UChar16 c) { return c == ' ' || c == '\t'; } |
| 135 | 135 |
| 136 const Font* const m_font; | 136 const Font* const m_font; |
| 137 const SimpleFontData* m_currentFontData; | 137 const SimpleFontData* m_currentFontData; |
| 138 HB_ShaperItem m_item; | 138 HB_ShaperItem m_item; |
| 139 uint16_t* m_glyphs16; // A vector of 16-bit glyph ids. | 139 uint16_t* m_glyphs16; // A vector of 16-bit glyph ids. |
| 140 SkScalar* m_xPositions; // A vector of x positions for each glyph. | 140 SkScalar* m_xPositions; // A vector of x positions for each glyph. |
| 141 ssize_t m_indexOfNextScriptRun; // Indexes the script run in |m_run|. | 141 ssize_t m_indexOfNextScriptRun; // Indexes the script run in |m_run|. |
| 142 unsigned m_offsetX; // Offset in pixels to the start of the next script run. | 142 unsigned m_offsetX; // Offset in pixels to the start of the next script run. |
| 143 unsigned m_pixelWidth; // Width (in px) of the current script run. | 143 unsigned m_pixelWidth; // Width (in px) of the current script run. |
| 144 unsigned m_numCodePoints; // Code points in current script run. | |
| 145 unsigned m_glyphsArrayCapacity; // Current size of all the Harfbuzz arrays. | 144 unsigned m_glyphsArrayCapacity; // Current size of all the Harfbuzz arrays. |
| 146 | 145 |
| 147 OwnPtr<TextRun> m_normalizedRun; | 146 OwnPtr<TextRun> m_normalizedRun; |
| 148 OwnArrayPtr<UChar> m_normalizedBuffer; // A buffer for normalized run. | 147 OwnArrayPtr<UChar> m_normalizedBuffer; // A buffer for normalized run. |
| 149 const TextRun& m_run; | 148 const TextRun& m_run; |
| 150 int m_wordSpacingAdjustment; // delta adjustment (pixels) for each word brea
k. | 149 int m_wordSpacingAdjustment; // delta adjustment (pixels) for each word brea
k. |
| 151 float m_padding; // pixels to be distributed over the line at word breaks. | 150 float m_padding; // pixels to be distributed over the line at word breaks. |
| 152 float m_padPerWordBreak; // pixels to be added to each word break. | 151 float m_padPerWordBreak; // pixels to be added to each word break. |
| 153 float m_padError; // |m_padPerWordBreak| might have a fractional component. | 152 float m_padError; // |m_padPerWordBreak| might have a fractional component. |
| 154 // Since we only add a whole number of padding pixels at | 153 // Since we only add a whole number of padding pixels at |
| 155 // each word break we accumulate error. This is the | 154 // each word break we accumulate error. This is the |
| 156 // number of pixels that we are behind so far. | 155 // number of pixels that we are behind so far. |
| 157 int m_letterSpacing; // pixels to be added after each glyph. | 156 int m_letterSpacing; // pixels to be added after each glyph. |
| 158 }; | 157 }; |
| 159 | 158 |
| 160 } // namespace WebCore | 159 } // namespace WebCore |
| 161 | 160 |
| 162 #endif // ComplexTextControllerLinux_h | 161 #endif // ComplexTextControllerLinux_h |
| OLD | NEW |