| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 Font& operator=(const Font&); | 93 Font& operator=(const Font&); |
| 94 | 94 |
| 95 bool operator==(const Font& other) const; | 95 bool operator==(const Font& other) const; |
| 96 bool operator!=(const Font& other) const { return !(*this == other); } | 96 bool operator!=(const Font& other) const { return !(*this == other); } |
| 97 | 97 |
| 98 const FontDescription& fontDescription() const { return m_fontDescription; } | 98 const FontDescription& fontDescription() const { return m_fontDescription; } |
| 99 | 99 |
| 100 void update(PassRefPtrWillBeRawPtr<FontSelector>) const; | 100 void update(PassRefPtrWillBeRawPtr<FontSelector>) const; |
| 101 | 101 |
| 102 enum CustomFontNotReadyAction { DoNotPaintIfFontNotReady, UseFallbackIfFontN
otReady }; | 102 enum CustomFontNotReadyAction { DoNotPaintIfFontNotReady, UseFallbackIfFontN
otReady }; |
| 103 void drawText(GraphicsContext*, const TextRunPaintInfo&, const FloatPoint&,
CustomFontNotReadyAction = DoNotPaintIfFontNotReady) const; | 103 float drawText(GraphicsContext*, const TextRunPaintInfo&, const FloatPoint&,
CustomFontNotReadyAction = DoNotPaintIfFontNotReady) const; |
| 104 void drawEmphasisMarks(GraphicsContext*, const TextRunPaintInfo&, const Atom
icString& mark, const FloatPoint&) const; | 104 void drawEmphasisMarks(GraphicsContext*, const TextRunPaintInfo&, const Atom
icString& mark, const FloatPoint&) const; |
| 105 | 105 |
| 106 float width(const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts =
0, GlyphOverflow* = 0) const; | 106 float width(const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts =
0, GlyphOverflow* = 0) const; |
| 107 float width(const TextRun&, int& charsConsumed, Glyph& glyphId) const; | 107 float width(const TextRun&, int& charsConsumed, Glyph& glyphId) const; |
| 108 | 108 |
| 109 int offsetForPosition(const TextRun&, float position, bool includePartialGly
phs) const; | 109 int offsetForPosition(const TextRun&, float position, bool includePartialGly
phs) const; |
| 110 FloatRect selectionRectForText(const TextRun&, const FloatPoint&, int h, int
from = 0, int to = -1, bool accountForGlyphBounds = false) const; | 110 FloatRect selectionRectForText(const TextRun&, const FloatPoint&, int h, int
from = 0, int to = -1, bool accountForGlyphBounds = false) const; |
| 111 | 111 |
| 112 bool isFixedPitch() const; | 112 bool isFixedPitch() const; |
| 113 | 113 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 133 std::pair<GlyphData, GlyphPage*> glyphDataAndPageForCharacter(UChar32, bool
mirror, FontDataVariant = AutoVariant) const; | 133 std::pair<GlyphData, GlyphPage*> glyphDataAndPageForCharacter(UChar32, bool
mirror, FontDataVariant = AutoVariant) const; |
| 134 bool primaryFontHasGlyphForCharacter(UChar32) const; | 134 bool primaryFontHasGlyphForCharacter(UChar32) const; |
| 135 | 135 |
| 136 CodePath codePath(const TextRun&) const; | 136 CodePath codePath(const TextRun&) const; |
| 137 | 137 |
| 138 private: | 138 private: |
| 139 enum ForTextEmphasisOrNot { NotForTextEmphasis, ForTextEmphasis }; | 139 enum ForTextEmphasisOrNot { NotForTextEmphasis, ForTextEmphasis }; |
| 140 | 140 |
| 141 // Returns the initial in-stream advance. | 141 // Returns the initial in-stream advance. |
| 142 float getGlyphsAndAdvancesForSimpleText(const TextRunPaintInfo&, GlyphBuffer
&, ForTextEmphasisOrNot = NotForTextEmphasis) const; | 142 float getGlyphsAndAdvancesForSimpleText(const TextRunPaintInfo&, GlyphBuffer
&, ForTextEmphasisOrNot = NotForTextEmphasis) const; |
| 143 void drawSimpleText(GraphicsContext*, const TextRunPaintInfo&, const FloatPo
int&) const; | 143 float drawSimpleText(GraphicsContext*, const TextRunPaintInfo&, const FloatP
oint&) const; |
| 144 void drawEmphasisMarksForSimpleText(GraphicsContext*, const TextRunPaintInfo
&, const AtomicString& mark, const FloatPoint&) const; | 144 void drawEmphasisMarksForSimpleText(GraphicsContext*, const TextRunPaintInfo
&, const AtomicString& mark, const FloatPoint&) const; |
| 145 void drawGlyphs(GraphicsContext*, const SimpleFontData*, const GlyphBuffer&,
unsigned from, unsigned numGlyphs, const FloatPoint&, const FloatRect& textRect
) const; | 145 void drawGlyphs(GraphicsContext*, const SimpleFontData*, const GlyphBuffer&,
unsigned from, unsigned numGlyphs, const FloatPoint&, const FloatRect& textRect
) const; |
| 146 void drawGlyphBuffer(GraphicsContext*, const TextRunPaintInfo&, const GlyphB
uffer&, const FloatPoint&) const; | 146 float drawGlyphBuffer(GraphicsContext*, const TextRunPaintInfo&, const Glyph
Buffer&, const FloatPoint&) const; |
| 147 void drawTextBlob(GraphicsContext*, const SkTextBlob*, const SkPoint& origin
) const; | 147 void drawTextBlob(GraphicsContext*, const SkTextBlob*, const SkPoint& origin
) const; |
| 148 void drawEmphasisMarks(GraphicsContext*, const TextRunPaintInfo&, const Glyp
hBuffer&, const AtomicString&, const FloatPoint&) const; | 148 void drawEmphasisMarks(GraphicsContext*, const TextRunPaintInfo&, const Glyp
hBuffer&, const AtomicString&, const FloatPoint&) const; |
| 149 float floatWidthForSimpleText(const TextRun&, HashSet<const SimpleFontData*>
* fallbackFonts = 0, IntRectExtent* glyphBounds = 0) const; | 149 float floatWidthForSimpleText(const TextRun&, HashSet<const SimpleFontData*>
* fallbackFonts = 0, IntRectExtent* glyphBounds = 0) const; |
| 150 int offsetForPositionForSimpleText(const TextRun&, float position, bool incl
udePartialGlyphs) const; | 150 int offsetForPositionForSimpleText(const TextRun&, float position, bool incl
udePartialGlyphs) const; |
| 151 FloatRect selectionRectForSimpleText(const TextRun&, const FloatPoint&, int
h, int from, int to, bool accountForGlyphBounds) const; | 151 FloatRect selectionRectForSimpleText(const TextRun&, const FloatPoint&, int
h, int from, int to, bool accountForGlyphBounds) const; |
| 152 | 152 |
| 153 bool getEmphasisMarkGlyphData(const AtomicString&, GlyphData&) const; | 153 bool getEmphasisMarkGlyphData(const AtomicString&, GlyphData&) const; |
| 154 | 154 |
| 155 // Returns the initial in-stream advance. | 155 // Returns the initial in-stream advance. |
| 156 float getGlyphsAndAdvancesForComplexText(const TextRunPaintInfo&, GlyphBuffe
r&, ForTextEmphasisOrNot = NotForTextEmphasis) const; | 156 float getGlyphsAndAdvancesForComplexText(const TextRunPaintInfo&, GlyphBuffe
r&, ForTextEmphasisOrNot = NotForTextEmphasis) const; |
| 157 void drawComplexText(GraphicsContext*, const TextRunPaintInfo&, const FloatP
oint&) const; | 157 float drawComplexText(GraphicsContext*, const TextRunPaintInfo&, const Float
Point&) const; |
| 158 void drawEmphasisMarksForComplexText(GraphicsContext*, const TextRunPaintInf
o&, const AtomicString& mark, const FloatPoint&) const; | 158 void drawEmphasisMarksForComplexText(GraphicsContext*, const TextRunPaintInf
o&, const AtomicString& mark, const FloatPoint&) const; |
| 159 float floatWidthForComplexText(const TextRun&, HashSet<const SimpleFontData*
>* fallbackFonts, IntRectExtent* glyphBounds) const; | 159 float floatWidthForComplexText(const TextRun&, HashSet<const SimpleFontData*
>* fallbackFonts, IntRectExtent* glyphBounds) const; |
| 160 int offsetForPositionForComplexText(const TextRun&, float position, bool inc
ludePartialGlyphs) const; | 160 int offsetForPositionForComplexText(const TextRun&, float position, bool inc
ludePartialGlyphs) const; |
| 161 FloatRect selectionRectForComplexText(const TextRun&, const FloatPoint&, int
h, int from, int to) const; | 161 FloatRect selectionRectForComplexText(const TextRun&, const FloatPoint&, int
h, int from, int to) const; |
| 162 | 162 |
| 163 friend struct WidthIterator; | 163 friend struct WidthIterator; |
| 164 friend class SVGTextRunRenderingContext; | 164 friend class SVGTextRunRenderingContext; |
| 165 | 165 |
| 166 public: | 166 public: |
| 167 // Useful for debugging the different font rendering code paths. | 167 // Useful for debugging the different font rendering code paths. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 180 bool loadingCustomFonts() const | 180 bool loadingCustomFonts() const |
| 181 { | 181 { |
| 182 return m_fontFallbackList && m_fontFallbackList->loadingCustomFonts(); | 182 return m_fontFallbackList && m_fontFallbackList->loadingCustomFonts(); |
| 183 } | 183 } |
| 184 | 184 |
| 185 bool shouldSkipDrawing() const | 185 bool shouldSkipDrawing() const |
| 186 { | 186 { |
| 187 return m_fontFallbackList && m_fontFallbackList->shouldSkipDrawing(); | 187 return m_fontFallbackList && m_fontFallbackList->shouldSkipDrawing(); |
| 188 } | 188 } |
| 189 | 189 |
| 190 PassTextBlobPtr buildTextBlob(const GlyphBuffer&, float initialAdvance, cons
t FloatRect& bounds) const; | 190 PassTextBlobPtr buildTextBlob(const GlyphBuffer&, float initialAdvance, cons
t FloatRect& bounds, float& advance) const; |
| 191 | 191 |
| 192 FontDescription m_fontDescription; | 192 FontDescription m_fontDescription; |
| 193 mutable RefPtr<FontFallbackList> m_fontFallbackList; | 193 mutable RefPtr<FontFallbackList> m_fontFallbackList; |
| 194 }; | 194 }; |
| 195 | 195 |
| 196 inline Font::~Font() | 196 inline Font::~Font() |
| 197 { | 197 { |
| 198 } | 198 } |
| 199 | 199 |
| 200 inline const SimpleFontData* Font::primaryFont() const | 200 inline const SimpleFontData* Font::primaryFont() const |
| (...skipping 23 matching lines...) Expand all Loading... |
| 224 { | 224 { |
| 225 if (!tabSize) | 225 if (!tabSize) |
| 226 return fontDescription().letterSpacing(); | 226 return fontDescription().letterSpacing(); |
| 227 float tabWidth = tabSize * fontData.spaceWidth() + fontDescription().letterS
pacing(); | 227 float tabWidth = tabSize * fontData.spaceWidth() + fontDescription().letterS
pacing(); |
| 228 return tabWidth - fmodf(position, tabWidth); | 228 return tabWidth - fmodf(position, tabWidth); |
| 229 } | 229 } |
| 230 | 230 |
| 231 } // namespace blink | 231 } // namespace blink |
| 232 | 232 |
| 233 #endif | 233 #endif |
| OLD | NEW |