Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(609)

Side by Side Diff: Source/platform/fonts/Font.h

Issue 141433026: Font metrics, version 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Adding Layout tests. Should work for simple text. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
93 void update(PassRefPtr<FontSelector>) const; 93 void update(PassRefPtr<FontSelector>) const;
94 94
95 enum CustomFontNotReadyAction { DoNotPaintIfFontNotReady, UseFallbackIfFontN otReady }; 95 enum CustomFontNotReadyAction { DoNotPaintIfFontNotReady, UseFallbackIfFontN otReady };
96 void drawText(GraphicsContext*, const TextRunPaintInfo&, const FloatPoint&, CustomFontNotReadyAction = DoNotPaintIfFontNotReady) const; 96 void drawText(GraphicsContext*, const TextRunPaintInfo&, const FloatPoint&, CustomFontNotReadyAction = DoNotPaintIfFontNotReady) const;
97 void drawEmphasisMarks(GraphicsContext*, const TextRunPaintInfo&, const Atom icString& mark, const FloatPoint&) const; 97 void drawEmphasisMarks(GraphicsContext*, const TextRunPaintInfo&, const Atom icString& mark, const FloatPoint&) const;
98 98
99 float width(const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const; 99 float width(const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const;
100 float width(const TextRun&, int& charsConsumed, String& glyphName) const; 100 float width(const TextRun&, int& charsConsumed, String& glyphName) const;
101 101
102 int offsetForPosition(const TextRun&, float position, bool includePartialGly phs) const; 102 int offsetForPosition(const TextRun&, float position, bool includePartialGly phs) const;
103 FloatRect selectionRectForText(const TextRun&, const FloatPoint&, int h, int from = 0, int to = -1) const; 103 FloatRect selectionRectForText(const TextRun&, const FloatPoint&, int h, int from = 0, int to = -1, bool accountForGlyphBounds = false) const;
104 104
105 float wordSpacing() const { return m_wordSpacing; } 105 float wordSpacing() const { return m_wordSpacing; }
106 float letterSpacing() const { return m_letterSpacing; } 106 float letterSpacing() const { return m_letterSpacing; }
107 void setWordSpacing(float s) { m_wordSpacing = s; } 107 void setWordSpacing(float s) { m_wordSpacing = s; }
108 void setLetterSpacing(float s) { m_letterSpacing = s; } 108 void setLetterSpacing(float s) { m_letterSpacing = s; }
109 bool isFixedPitch() const; 109 bool isFixedPitch() const;
110 110
111 TypesettingFeatures typesettingFeatures() const { return static_cast<Typeset tingFeatures>(m_typesettingFeatures); } 111 TypesettingFeatures typesettingFeatures() const { return static_cast<Typeset tingFeatures>(m_typesettingFeatures); }
112 112
113 // Metrics that we query the FontFallbackList for. 113 // Metrics that we query the FontFallbackList for.
(...skipping 28 matching lines...) Expand all
142 142
143 // Returns the initial in-stream advance. 143 // Returns the initial in-stream advance.
144 float getGlyphsAndAdvancesForSimpleText(const TextRun&, int from, int to, Gl yphBuffer&, ForTextEmphasisOrNot = NotForTextEmphasis) const; 144 float getGlyphsAndAdvancesForSimpleText(const TextRun&, int from, int to, Gl yphBuffer&, ForTextEmphasisOrNot = NotForTextEmphasis) const;
145 void drawSimpleText(GraphicsContext*, const TextRunPaintInfo&, const FloatPo int&) const; 145 void drawSimpleText(GraphicsContext*, const TextRunPaintInfo&, const FloatPo int&) const;
146 void drawEmphasisMarksForSimpleText(GraphicsContext*, const TextRunPaintInfo &, const AtomicString& mark, const FloatPoint&) const; 146 void drawEmphasisMarksForSimpleText(GraphicsContext*, const TextRunPaintInfo &, const AtomicString& mark, const FloatPoint&) const;
147 void drawGlyphs(GraphicsContext*, const SimpleFontData*, const GlyphBuffer&, unsigned from, unsigned numGlyphs, const FloatPoint&, const FloatRect& textRect ) const; 147 void drawGlyphs(GraphicsContext*, const SimpleFontData*, const GlyphBuffer&, unsigned from, unsigned numGlyphs, const FloatPoint&, const FloatRect& textRect ) const;
148 void drawGlyphBuffer(GraphicsContext*, const TextRunPaintInfo&, const GlyphB uffer&, const FloatPoint&) const; 148 void drawGlyphBuffer(GraphicsContext*, const TextRunPaintInfo&, const GlyphB uffer&, const FloatPoint&) const;
149 void drawEmphasisMarks(GraphicsContext*, const TextRunPaintInfo&, const Glyp hBuffer&, const AtomicString&, const FloatPoint&) const; 149 void drawEmphasisMarks(GraphicsContext*, const TextRunPaintInfo&, const Glyp hBuffer&, const AtomicString&, const FloatPoint&) const;
150 float floatWidthForSimpleText(const TextRun&, HashSet<const SimpleFontData*> * fallbackFonts = 0, GlyphOverflow* = 0) const; 150 float floatWidthForSimpleText(const TextRun&, HashSet<const SimpleFontData*> * fallbackFonts = 0, GlyphOverflow* = 0) const;
151 int offsetForPositionForSimpleText(const TextRun&, float position, bool incl udePartialGlyphs) const; 151 int offsetForPositionForSimpleText(const TextRun&, float position, bool incl udePartialGlyphs) const;
152 FloatRect selectionRectForSimpleText(const TextRun&, const FloatPoint&, int h, int from, int to) const; 152 FloatRect selectionRectForSimpleText(const TextRun&, const FloatPoint&, int h, int from, int to, bool accountForGlyphBounds) const;
153 153
154 bool getEmphasisMarkGlyphData(const AtomicString&, GlyphData&) const; 154 bool getEmphasisMarkGlyphData(const AtomicString&, GlyphData&) const;
155 155
156 // Returns the initial in-stream advance. 156 // Returns the initial in-stream advance.
157 float getGlyphsAndAdvancesForComplexText(const TextRun&, int from, int to, G lyphBuffer&, ForTextEmphasisOrNot = NotForTextEmphasis) const; 157 float getGlyphsAndAdvancesForComplexText(const TextRun&, int from, int to, G lyphBuffer&, ForTextEmphasisOrNot = NotForTextEmphasis) const;
158 void drawComplexText(GraphicsContext*, const TextRunPaintInfo&, const FloatP oint&) const; 158 void drawComplexText(GraphicsContext*, const TextRunPaintInfo&, const FloatP oint&) const;
159 void drawEmphasisMarksForComplexText(GraphicsContext*, const TextRunPaintInf o&, const AtomicString& mark, const FloatPoint&) const; 159 void drawEmphasisMarksForComplexText(GraphicsContext*, const TextRunPaintInf o&, const AtomicString& mark, const FloatPoint&) const;
160 float floatWidthForComplexText(const TextRun&, HashSet<const SimpleFontData* >* fallbackFonts = 0, GlyphOverflow* = 0) const; 160 float floatWidthForComplexText(const TextRun&, HashSet<const SimpleFontData* >* fallbackFonts = 0, GlyphOverflow* = 0) const;
161 int offsetForPositionForComplexText(const TextRun&, float position, bool inc ludePartialGlyphs) const; 161 int offsetForPositionForComplexText(const TextRun&, float position, bool inc ludePartialGlyphs) const;
162 FloatRect selectionRectForComplexText(const TextRun&, const FloatPoint&, int h, int from, int to) const; 162 FloatRect selectionRectForComplexText(const TextRun&, const FloatPoint&, int h, int from, int to) const;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 { 267 {
268 if (!tabSize) 268 if (!tabSize)
269 return letterSpacing(); 269 return letterSpacing();
270 float tabWidth = tabSize * fontData.spaceWidth() + letterSpacing(); 270 float tabWidth = tabSize * fontData.spaceWidth() + letterSpacing();
271 return tabWidth - fmodf(position, tabWidth); 271 return tabWidth - fmodf(position, tabWidth);
272 } 272 }
273 273
274 } 274 }
275 275
276 #endif 276 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698