| 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(PassRefPtr<FontSelector>) const; | 100 void update(PassRefPtr<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 void drawText(GraphicsContext*, const TextRunPaintInfo&, const FloatPoint&)
const; |
| 104 float drawUncachedText(GraphicsContext*, const TextRunPaintInfo&, const Floa
tPoint&, CustomFontNotReadyAction) const; |
| 104 void drawEmphasisMarks(GraphicsContext*, const TextRunPaintInfo&, const Atom
icString& mark, const FloatPoint&) const; | 105 void drawEmphasisMarks(GraphicsContext*, const TextRunPaintInfo&, const Atom
icString& mark, const FloatPoint&) const; |
| 105 | 106 |
| 106 float width(const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts =
0, GlyphOverflow* = 0) const; | 107 float width(const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts =
0, GlyphOverflow* = 0) const; |
| 107 float width(const TextRun&, int& charsConsumed, Glyph& glyphId) const; | 108 float width(const TextRun&, int& charsConsumed, Glyph& glyphId) const; |
| 108 | 109 |
| 109 int offsetForPosition(const TextRun&, float position, bool includePartialGly
phs) const; | 110 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; | 111 FloatRect selectionRectForText(const TextRun&, const FloatPoint&, int h, int
from = 0, int to = -1, bool accountForGlyphBounds = false) const; |
| 111 | 112 |
| 112 bool isFixedPitch() const; | 113 bool isFixedPitch() const; |
| 113 | 114 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 129 } | 130 } |
| 130 std::pair<GlyphData, GlyphPage*> glyphDataAndPageForCharacter(UChar32, bool
mirror, FontDataVariant = AutoVariant) const; | 131 std::pair<GlyphData, GlyphPage*> glyphDataAndPageForCharacter(UChar32, bool
mirror, FontDataVariant = AutoVariant) const; |
| 131 bool primaryFontHasGlyphForCharacter(UChar32) const; | 132 bool primaryFontHasGlyphForCharacter(UChar32) const; |
| 132 | 133 |
| 133 CodePath codePath(const TextRun&) const; | 134 CodePath codePath(const TextRun&) const; |
| 134 | 135 |
| 135 private: | 136 private: |
| 136 enum ForTextEmphasisOrNot { NotForTextEmphasis, ForTextEmphasis }; | 137 enum ForTextEmphasisOrNot { NotForTextEmphasis, ForTextEmphasis }; |
| 137 | 138 |
| 138 // Returns the initial in-stream advance. | 139 // Returns the initial in-stream advance. |
| 139 float getGlyphsAndAdvancesForSimpleText(const TextRunPaintInfo&, GlyphBuffer
&, ForTextEmphasisOrNot = NotForTextEmphasis) const; | 140 float buildGlyphBuffer(const TextRunPaintInfo&, GlyphBuffer&, ForTextEmphasi
sOrNot = NotForTextEmphasis) const; |
| 140 void drawSimpleText(GraphicsContext*, const TextRunPaintInfo&, const FloatPo
int&) const; | 141 PassTextBlobPtr buildTextBlob(const GlyphBuffer&, float initialAdvance, cons
t FloatRect& bounds) const; |
| 141 void drawEmphasisMarksForSimpleText(GraphicsContext*, const TextRunPaintInfo
&, const AtomicString& mark, const FloatPoint&) const; | |
| 142 void drawGlyphs(GraphicsContext*, const SimpleFontData*, const GlyphBuffer&,
unsigned from, unsigned numGlyphs, const FloatPoint&, const FloatRect& textRect
) const; | 142 void drawGlyphs(GraphicsContext*, const SimpleFontData*, const GlyphBuffer&,
unsigned from, unsigned numGlyphs, const FloatPoint&, const FloatRect& textRect
) const; |
| 143 void drawGlyphBuffer(GraphicsContext*, const TextRunPaintInfo&, const GlyphB
uffer&, const FloatPoint&) const; | |
| 144 void drawTextBlob(GraphicsContext*, const SkTextBlob*, const SkPoint& origin
) const; | 143 void drawTextBlob(GraphicsContext*, const SkTextBlob*, const SkPoint& origin
) const; |
| 144 float drawGlyphBuffer(GraphicsContext*, const TextRunPaintInfo&, const Glyph
Buffer&, const FloatPoint&) const; |
| 145 void drawEmphasisMarks(GraphicsContext*, const TextRunPaintInfo&, const Glyp
hBuffer&, const AtomicString&, const FloatPoint&) const; | 145 void drawEmphasisMarks(GraphicsContext*, const TextRunPaintInfo&, const Glyp
hBuffer&, const AtomicString&, const FloatPoint&) const; |
| 146 float floatWidthForSimpleText(const TextRun&, HashSet<const SimpleFontData*>
* fallbackFonts = 0, IntRectExtent* glyphBounds = 0) const; | 146 float floatWidthForSimpleText(const TextRun&, HashSet<const SimpleFontData*>
* fallbackFonts = 0, IntRectExtent* glyphBounds = 0) const; |
| 147 int offsetForPositionForSimpleText(const TextRun&, float position, bool incl
udePartialGlyphs) const; | 147 int offsetForPositionForSimpleText(const TextRun&, float position, bool incl
udePartialGlyphs) const; |
| 148 FloatRect selectionRectForSimpleText(const TextRun&, const FloatPoint&, int
h, int from, int to, bool accountForGlyphBounds) const; | 148 FloatRect selectionRectForSimpleText(const TextRun&, const FloatPoint&, int
h, int from, int to, bool accountForGlyphBounds) const; |
| 149 | 149 |
| 150 bool getEmphasisMarkGlyphData(const AtomicString&, GlyphData&) const; | 150 bool getEmphasisMarkGlyphData(const AtomicString&, GlyphData&) const; |
| 151 | 151 |
| 152 // Returns the initial in-stream advance. | |
| 153 float getGlyphsAndAdvancesForComplexText(const TextRunPaintInfo&, GlyphBuffe
r&, ForTextEmphasisOrNot = NotForTextEmphasis) const; | |
| 154 void drawComplexText(GraphicsContext*, const TextRunPaintInfo&, const FloatP
oint&) const; | |
| 155 void drawEmphasisMarksForComplexText(GraphicsContext*, const TextRunPaintInf
o&, const AtomicString& mark, const FloatPoint&) const; | |
| 156 float floatWidthForComplexText(const TextRun&, HashSet<const SimpleFontData*
>* fallbackFonts, IntRectExtent* glyphBounds) const; | 152 float floatWidthForComplexText(const TextRun&, HashSet<const SimpleFontData*
>* fallbackFonts, IntRectExtent* glyphBounds) const; |
| 157 int offsetForPositionForComplexText(const TextRun&, float position, bool inc
ludePartialGlyphs) const; | 153 int offsetForPositionForComplexText(const TextRun&, float position, bool inc
ludePartialGlyphs) const; |
| 158 FloatRect selectionRectForComplexText(const TextRun&, const FloatPoint&, int
h, int from, int to) const; | 154 FloatRect selectionRectForComplexText(const TextRun&, const FloatPoint&, int
h, int from, int to) const; |
| 159 | 155 |
| 160 friend struct WidthIterator; | 156 friend struct WidthIterator; |
| 161 | 157 |
| 162 public: | 158 public: |
| 163 // Useful for debugging the different font rendering code paths. | 159 // Useful for debugging the different font rendering code paths. |
| 164 static void setCodePath(CodePath); | 160 static void setCodePath(CodePath); |
| 165 static CodePath codePath(); | 161 static CodePath codePath(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 176 bool loadingCustomFonts() const | 172 bool loadingCustomFonts() const |
| 177 { | 173 { |
| 178 return m_fontFallbackList && m_fontFallbackList->loadingCustomFonts(); | 174 return m_fontFallbackList && m_fontFallbackList->loadingCustomFonts(); |
| 179 } | 175 } |
| 180 | 176 |
| 181 bool shouldSkipDrawing() const | 177 bool shouldSkipDrawing() const |
| 182 { | 178 { |
| 183 return m_fontFallbackList && m_fontFallbackList->shouldSkipDrawing(); | 179 return m_fontFallbackList && m_fontFallbackList->shouldSkipDrawing(); |
| 184 } | 180 } |
| 185 | 181 |
| 186 PassTextBlobPtr buildTextBlob(const GlyphBuffer&, float initialAdvance, cons
t FloatRect& bounds) const; | |
| 187 | |
| 188 FontDescription m_fontDescription; | 182 FontDescription m_fontDescription; |
| 189 mutable RefPtr<FontFallbackList> m_fontFallbackList; | 183 mutable RefPtr<FontFallbackList> m_fontFallbackList; |
| 190 }; | 184 }; |
| 191 | 185 |
| 192 inline Font::~Font() | 186 inline Font::~Font() |
| 193 { | 187 { |
| 194 } | 188 } |
| 195 | 189 |
| 196 inline const SimpleFontData* Font::primaryFont() const | 190 inline const SimpleFontData* Font::primaryFont() const |
| 197 { | 191 { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 220 { | 214 { |
| 221 if (!tabSize) | 215 if (!tabSize) |
| 222 return fontDescription().letterSpacing(); | 216 return fontDescription().letterSpacing(); |
| 223 float tabWidth = tabSize * fontData.spaceWidth() + fontDescription().letterS
pacing(); | 217 float tabWidth = tabSize * fontData.spaceWidth() + fontDescription().letterS
pacing(); |
| 224 return tabWidth - fmodf(position, tabWidth); | 218 return tabWidth - fmodf(position, tabWidth); |
| 225 } | 219 } |
| 226 | 220 |
| 227 } // namespace blink | 221 } // namespace blink |
| 228 | 222 |
| 229 #endif // SKY_ENGINE_PLATFORM_FONTS_FONT_H_ | 223 #endif // SKY_ENGINE_PLATFORM_FONTS_FONT_H_ |
| OLD | NEW |