| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 Font(); | 64 Font(); |
| 65 Font(const FontDescription&); | 65 Font(const FontDescription&); |
| 66 ~Font(); | 66 ~Font(); |
| 67 | 67 |
| 68 Font(const Font&); | 68 Font(const Font&); |
| 69 Font& operator=(const Font&); | 69 Font& operator=(const Font&); |
| 70 | 70 |
| 71 bool operator==(const Font& other) const; | 71 bool operator==(const Font& other) const; |
| 72 bool operator!=(const Font& other) const { return !(*this == other); } | 72 bool operator!=(const Font& other) const { return !(*this == other); } |
| 73 | 73 |
| 74 const FontDescription& fontDescription() const { return m_fontDescription; } | 74 const FontDescription& getFontDescription() const { return m_fontDescription
; } |
| 75 | 75 |
| 76 void update(PassRefPtrWillBeRawPtr<FontSelector>) const; | 76 void update(PassRefPtrWillBeRawPtr<FontSelector>) const; |
| 77 | 77 |
| 78 enum CustomFontNotReadyAction { DoNotPaintIfFontNotReady, UseFallbackIfFontN
otReady }; | 78 enum CustomFontNotReadyAction { DoNotPaintIfFontNotReady, UseFallbackIfFontN
otReady }; |
| 79 bool drawText(SkCanvas*, const TextRunPaintInfo&, const FloatPoint&, float d
eviceScaleFactor, const SkPaint&) const; | 79 bool drawText(SkCanvas*, const TextRunPaintInfo&, const FloatPoint&, float d
eviceScaleFactor, const SkPaint&) const; |
| 80 bool drawBidiText(SkCanvas*, const TextRunPaintInfo&, const FloatPoint&, Cus
tomFontNotReadyAction, float deviceScaleFactor, const SkPaint&) const; | 80 bool drawBidiText(SkCanvas*, const TextRunPaintInfo&, const FloatPoint&, Cus
tomFontNotReadyAction, float deviceScaleFactor, const SkPaint&) const; |
| 81 void drawEmphasisMarks(SkCanvas*, const TextRunPaintInfo&, const AtomicStrin
g& mark, const FloatPoint&, float deviceScaleFactor, const SkPaint&) const; | 81 void drawEmphasisMarks(SkCanvas*, const TextRunPaintInfo&, const AtomicStrin
g& mark, const FloatPoint&, float deviceScaleFactor, const SkPaint&) const; |
| 82 | 82 |
| 83 // Glyph bounds will be the minimum rect containing all glyph strokes, in co
ordinates using | 83 // Glyph bounds will be the minimum rect containing all glyph strokes, in co
ordinates using |
| 84 // (<text run x position>, <baseline position>) as the origin. | 84 // (<text run x position>, <baseline position>) as the origin. |
| 85 float width(const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts =
nullptr, FloatRect* glyphBounds = nullptr) const; | 85 float width(const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts =
nullptr, FloatRect* glyphBounds = nullptr) const; |
| 86 | 86 |
| 87 int offsetForPosition(const TextRun&, float position, bool includePartialGly
phs) const; | 87 int offsetForPosition(const TextRun&, float position, bool includePartialGly
phs) const; |
| 88 FloatRect selectionRectForText(const TextRun&, const FloatPoint&, int h, int
from = 0, int to = -1, bool accountForGlyphBounds = false) const; | 88 FloatRect selectionRectForText(const TextRun&, const FloatPoint&, int h, int
from = 0, int to = -1, bool accountForGlyphBounds = false) const; |
| 89 | 89 |
| 90 // Metrics that we query the FontFallbackList for. | 90 // Metrics that we query the FontFallbackList for. |
| 91 const FontMetrics& fontMetrics() const | 91 const FontMetrics& getFontMetrics() const |
| 92 { | 92 { |
| 93 RELEASE_ASSERT(primaryFont()); | 93 RELEASE_ASSERT(primaryFont()); |
| 94 return primaryFont()->fontMetrics(); | 94 return primaryFont()->getFontMetrics(); |
| 95 } | 95 } |
| 96 float spaceWidth() const { return primaryFont()->spaceWidth() + fontDescript
ion().letterSpacing(); } | 96 float spaceWidth() const { return primaryFont()->spaceWidth() + getFontDescr
iption().letterSpacing(); } |
| 97 float tabWidth(const SimpleFontData&, const TabSize&, float position) const; | 97 float tabWidth(const SimpleFontData&, const TabSize&, float position) const; |
| 98 float tabWidth(const TabSize& tabSize, float position) const { return tabWid
th(*primaryFont(), tabSize, position); } | 98 float tabWidth(const TabSize& tabSize, float position) const { return tabWid
th(*primaryFont(), tabSize, position); } |
| 99 | 99 |
| 100 int emphasisMarkAscent(const AtomicString&) const; | 100 int emphasisMarkAscent(const AtomicString&) const; |
| 101 int emphasisMarkDescent(const AtomicString&) const; | 101 int emphasisMarkDescent(const AtomicString&) const; |
| 102 int emphasisMarkHeight(const AtomicString&) const; | 102 int emphasisMarkHeight(const AtomicString&) const; |
| 103 | 103 |
| 104 const SimpleFontData* primaryFont() const; | 104 const SimpleFontData* primaryFont() const; |
| 105 const FontData* fontDataAt(unsigned) const; | 105 const FontData* fontDataAt(unsigned) const; |
| 106 | 106 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 132 | 132 |
| 133 float floatWidthForComplexText(const TextRun&, HashSet<const SimpleFontData*
>* fallbackFonts, FloatRect* glyphBounds) const; | 133 float floatWidthForComplexText(const TextRun&, HashSet<const SimpleFontData*
>* fallbackFonts, FloatRect* glyphBounds) const; |
| 134 int offsetForPositionForComplexText(const TextRun&, float position, bool inc
ludePartialGlyphs) const; | 134 int offsetForPositionForComplexText(const TextRun&, float position, bool inc
ludePartialGlyphs) const; |
| 135 FloatRect selectionRectForComplexText(const TextRun&, const FloatPoint&, int
h, int from, int to) const; | 135 FloatRect selectionRectForComplexText(const TextRun&, const FloatPoint&, int
h, int from, int to) const; |
| 136 | 136 |
| 137 bool computeCanShapeWordByWord() const; | 137 bool computeCanShapeWordByWord() const; |
| 138 | 138 |
| 139 friend struct SimpleShaper; | 139 friend struct SimpleShaper; |
| 140 | 140 |
| 141 public: | 141 public: |
| 142 FontSelector* fontSelector() const; | 142 FontSelector* getFontSelector() const; |
| 143 PassRefPtr<FontFallbackIterator> createFontFallbackIterator( | 143 PassRefPtr<FontFallbackIterator> createFontFallbackIterator( |
| 144 FontFallbackPriority) const; | 144 FontFallbackPriority) const; |
| 145 | 145 |
| 146 void willUseFontData(UChar32) const; | 146 void willUseFontData(UChar32) const; |
| 147 | 147 |
| 148 bool loadingCustomFonts() const; | 148 bool loadingCustomFonts() const; |
| 149 bool isFallbackValid() const; | 149 bool isFallbackValid() const; |
| 150 | 150 |
| 151 private: | 151 private: |
| 152 bool shouldSkipDrawing() const | 152 bool shouldSkipDrawing() const |
| (...skipping 19 matching lines...) Expand all Loading... |
| 172 ASSERT(m_fontFallbackList); | 172 ASSERT(m_fontFallbackList); |
| 173 return m_fontFallbackList->primarySimpleFontData(m_fontDescription); | 173 return m_fontFallbackList->primarySimpleFontData(m_fontDescription); |
| 174 } | 174 } |
| 175 | 175 |
| 176 inline const FontData* Font::fontDataAt(unsigned index) const | 176 inline const FontData* Font::fontDataAt(unsigned index) const |
| 177 { | 177 { |
| 178 ASSERT(m_fontFallbackList); | 178 ASSERT(m_fontFallbackList); |
| 179 return m_fontFallbackList->fontDataAt(m_fontDescription, index); | 179 return m_fontFallbackList->fontDataAt(m_fontDescription, index); |
| 180 } | 180 } |
| 181 | 181 |
| 182 inline FontSelector* Font::fontSelector() const | 182 inline FontSelector* Font::getFontSelector() const |
| 183 { | 183 { |
| 184 return m_fontFallbackList ? m_fontFallbackList->fontSelector() : 0; | 184 return m_fontFallbackList ? m_fontFallbackList->getFontSelector() : 0; |
| 185 } | 185 } |
| 186 | 186 |
| 187 inline float Font::tabWidth(const SimpleFontData& fontData, const TabSize& tabSi
ze, float position) const | 187 inline float Font::tabWidth(const SimpleFontData& fontData, const TabSize& tabSi
ze, float position) const |
| 188 { | 188 { |
| 189 float baseTabWidth = tabSize.getPixelSize(fontData.spaceWidth()); | 189 float baseTabWidth = tabSize.getPixelSize(fontData.spaceWidth()); |
| 190 if (!baseTabWidth) | 190 if (!baseTabWidth) |
| 191 return fontDescription().letterSpacing(); | 191 return getFontDescription().letterSpacing(); |
| 192 float distanceToTabStop = baseTabWidth - fmodf(position, baseTabWidth); | 192 float distanceToTabStop = baseTabWidth - fmodf(position, baseTabWidth); |
| 193 | 193 |
| 194 // The smallest allowable tab space is letterSpacing() (but must be at least
one layout unit). | 194 // The smallest allowable tab space is letterSpacing() (but must be at least
one layout unit). |
| 195 // if the distance to the next tab stop is less than that, advance an additi
onal tab stop. | 195 // if the distance to the next tab stop is less than that, advance an additi
onal tab stop. |
| 196 if (distanceToTabStop < std::max(fontDescription().letterSpacing(), LayoutUn
it::epsilon())) | 196 if (distanceToTabStop < std::max(getFontDescription().letterSpacing(), Layou
tUnit::epsilon())) |
| 197 distanceToTabStop += baseTabWidth; | 197 distanceToTabStop += baseTabWidth; |
| 198 | 198 |
| 199 return distanceToTabStop; | 199 return distanceToTabStop; |
| 200 } | 200 } |
| 201 | 201 |
| 202 } // namespace blink | 202 } // namespace blink |
| 203 | 203 |
| 204 #endif | 204 #endif |
| OLD | NEW |