| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) | 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2003, 2006, 2007, 2010, 2011 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2006, 2007, 2010, 2011 Apple Inc. All rights reserved. |
| 6 * Copyright (C) 2008 Holger Hans Peter Freyther | 6 * Copyright (C) 2008 Holger Hans Peter Freyther |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #define Font_h | 26 #define Font_h |
| 27 | 27 |
| 28 #include "platform/LayoutUnit.h" | 28 #include "platform/LayoutUnit.h" |
| 29 #include "platform/PlatformExport.h" | 29 #include "platform/PlatformExport.h" |
| 30 #include "platform/fonts/FontDescription.h" | 30 #include "platform/fonts/FontDescription.h" |
| 31 #include "platform/fonts/FontFallbackList.h" | 31 #include "platform/fonts/FontFallbackList.h" |
| 32 #include "platform/fonts/FontFallbackPriority.h" | 32 #include "platform/fonts/FontFallbackPriority.h" |
| 33 #include "platform/fonts/SimpleFontData.h" | 33 #include "platform/fonts/SimpleFontData.h" |
| 34 #include "platform/text/TabSize.h" | 34 #include "platform/text/TabSize.h" |
| 35 #include "platform/text/TextDirection.h" | 35 #include "platform/text/TextDirection.h" |
| 36 #include "skia/ext/cdl_common.h" |
| 36 #include "wtf/Allocator.h" | 37 #include "wtf/Allocator.h" |
| 37 #include "wtf/HashMap.h" | 38 #include "wtf/HashMap.h" |
| 38 #include "wtf/HashSet.h" | 39 #include "wtf/HashSet.h" |
| 39 #include "wtf/MathExtras.h" | 40 #include "wtf/MathExtras.h" |
| 40 #include "wtf/text/CharacterNames.h" | 41 #include "wtf/text/CharacterNames.h" |
| 41 | 42 |
| 42 class SkCanvas; | |
| 43 class SkPaint; | |
| 44 | |
| 45 namespace blink { | 43 namespace blink { |
| 46 | 44 |
| 47 struct CharacterRange; | 45 struct CharacterRange; |
| 48 class FloatPoint; | 46 class FloatPoint; |
| 49 class FloatRect; | 47 class FloatRect; |
| 50 class FontFallbackIterator; | 48 class FontFallbackIterator; |
| 51 class FontData; | 49 class FontData; |
| 52 class FontSelector; | 50 class FontSelector; |
| 53 class GlyphBuffer; | 51 class GlyphBuffer; |
| 54 class ShapeCache; | 52 class ShapeCache; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 72 const FontDescription& getFontDescription() const { | 70 const FontDescription& getFontDescription() const { |
| 73 return m_fontDescription; | 71 return m_fontDescription; |
| 74 } | 72 } |
| 75 | 73 |
| 76 void update(FontSelector*) const; | 74 void update(FontSelector*) const; |
| 77 | 75 |
| 78 enum CustomFontNotReadyAction { | 76 enum CustomFontNotReadyAction { |
| 79 DoNotPaintIfFontNotReady, | 77 DoNotPaintIfFontNotReady, |
| 80 UseFallbackIfFontNotReady | 78 UseFallbackIfFontNotReady |
| 81 }; | 79 }; |
| 82 bool drawText(SkCanvas*, | 80 bool drawText(CdlCanvas*, |
| 83 const TextRunPaintInfo&, | 81 const TextRunPaintInfo&, |
| 84 const FloatPoint&, | 82 const FloatPoint&, |
| 85 float deviceScaleFactor, | 83 float deviceScaleFactor, |
| 86 const SkPaint&) const; | 84 const CdlPaint&) const; |
| 87 bool drawBidiText(SkCanvas*, | 85 bool drawBidiText(CdlCanvas*, |
| 88 const TextRunPaintInfo&, | 86 const TextRunPaintInfo&, |
| 89 const FloatPoint&, | 87 const FloatPoint&, |
| 90 CustomFontNotReadyAction, | 88 CustomFontNotReadyAction, |
| 91 float deviceScaleFactor, | 89 float deviceScaleFactor, |
| 92 const SkPaint&) const; | 90 const CdlPaint&) const; |
| 93 void drawEmphasisMarks(SkCanvas*, | 91 void drawEmphasisMarks(CdlCanvas*, |
| 94 const TextRunPaintInfo&, | 92 const TextRunPaintInfo&, |
| 95 const AtomicString& mark, | 93 const AtomicString& mark, |
| 96 const FloatPoint&, | 94 const FloatPoint&, |
| 97 float deviceScaleFactor, | 95 float deviceScaleFactor, |
| 98 const SkPaint&) const; | 96 const CdlPaint&) const; |
| 99 | 97 |
| 100 struct TextIntercept { | 98 struct TextIntercept { |
| 101 float m_begin, m_end; | 99 float m_begin, m_end; |
| 102 }; | 100 }; |
| 103 | 101 |
| 104 // Compute the text intercepts along the axis of the advance and write them | 102 // Compute the text intercepts along the axis of the advance and write them |
| 105 // into the specified Vector of TextIntercepts. The number of those is zero or | 103 // into the specified Vector of TextIntercepts. The number of those is zero or |
| 106 // a multiple of two, and is at most the number of glyphs * 2 in the TextRun | 104 // a multiple of two, and is at most the number of glyphs * 2 in the TextRun |
| 107 // part of TextRunPaintInfo. Specify bounds for the upper and lower extend of | 105 // part of TextRunPaintInfo. Specify bounds for the upper and lower extend of |
| 108 // a line crossing through the text, parallel to the baseline. | 106 // a line crossing through the text, parallel to the baseline. |
| 109 // TODO(drott): crbug.com/655154 Fix this for | 107 // TODO(drott): crbug.com/655154 Fix this for |
| 110 // upright in vertical. | 108 // upright in vertical. |
| 111 void getTextIntercepts(const TextRunPaintInfo&, | 109 void getTextIntercepts(const TextRunPaintInfo&, |
| 112 float deviceScaleFactor, | 110 float deviceScaleFactor, |
| 113 const SkPaint&, | 111 const CdlPaint&, |
| 114 const std::tuple<float, float>& bounds, | 112 const std::tuple<float, float>& bounds, |
| 115 Vector<TextIntercept>&) const; | 113 Vector<TextIntercept>&) const; |
| 116 | 114 |
| 117 // Glyph bounds will be the minimum rect containing all glyph strokes, in | 115 // Glyph bounds will be the minimum rect containing all glyph strokes, in |
| 118 // coordinates using (<text run x position>, <baseline position>) as the | 116 // coordinates using (<text run x position>, <baseline position>) as the |
| 119 // origin. | 117 // origin. |
| 120 float width(const TextRun&, | 118 float width(const TextRun&, |
| 121 HashSet<const SimpleFontData*>* fallbackFonts = nullptr, | 119 HashSet<const SimpleFontData*>* fallbackFonts = nullptr, |
| 122 FloatRect* glyphBounds = nullptr) const; | 120 FloatRect* glyphBounds = nullptr) const; |
| 123 | 121 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 m_shapeWordByWordComputed = true; | 168 m_shapeWordByWordComputed = true; |
| 171 } | 169 } |
| 172 | 170 |
| 173 private: | 171 private: |
| 174 enum ForTextEmphasisOrNot { NotForTextEmphasis, ForTextEmphasis }; | 172 enum ForTextEmphasisOrNot { NotForTextEmphasis, ForTextEmphasis }; |
| 175 | 173 |
| 176 // Returns the total advance. | 174 // Returns the total advance. |
| 177 float buildGlyphBuffer(const TextRunPaintInfo&, | 175 float buildGlyphBuffer(const TextRunPaintInfo&, |
| 178 GlyphBuffer&, | 176 GlyphBuffer&, |
| 179 const GlyphData* emphasisData = nullptr) const; | 177 const GlyphData* emphasisData = nullptr) const; |
| 180 void drawGlyphBuffer(SkCanvas*, | 178 void drawGlyphBuffer(CdlCanvas*, |
| 181 const SkPaint&, | 179 const CdlPaint&, |
| 182 const TextRunPaintInfo&, | 180 const TextRunPaintInfo&, |
| 183 const GlyphBuffer&, | 181 const GlyphBuffer&, |
| 184 const FloatPoint&, | 182 const FloatPoint&, |
| 185 float deviceScaleFactor) const; | 183 float deviceScaleFactor) const; |
| 186 | 184 |
| 187 bool getEmphasisMarkGlyphData(const AtomicString&, GlyphData&) const; | 185 bool getEmphasisMarkGlyphData(const AtomicString&, GlyphData&) const; |
| 188 | 186 |
| 189 bool computeCanShapeWordByWord() const; | 187 bool computeCanShapeWordByWord() const; |
| 190 | 188 |
| 191 friend struct SimpleShaper; | 189 friend struct SimpleShaper; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 // advance an additional tab stop. | 244 // advance an additional tab stop. |
| 247 if (distanceToTabStop < fontData->spaceWidth() / 2) | 245 if (distanceToTabStop < fontData->spaceWidth() / 2) |
| 248 distanceToTabStop += baseTabWidth; | 246 distanceToTabStop += baseTabWidth; |
| 249 | 247 |
| 250 return distanceToTabStop; | 248 return distanceToTabStop; |
| 251 } | 249 } |
| 252 | 250 |
| 253 } // namespace blink | 251 } // namespace blink |
| 254 | 252 |
| 255 #endif | 253 #endif |
| OLD | NEW |