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

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: Fixed windows layout tests Created 6 years, 9 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
« no previous file with comments | « Source/core/html/canvas/CanvasRenderingContext2D.cpp ('k') | Source/platform/fonts/Font.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 void update(PassRefPtr<FontSelector>) const; 95 void update(PassRefPtr<FontSelector>) const;
96 96
97 enum CustomFontNotReadyAction { DoNotPaintIfFontNotReady, UseFallbackIfFontN otReady }; 97 enum CustomFontNotReadyAction { DoNotPaintIfFontNotReady, UseFallbackIfFontN otReady };
98 void drawText(GraphicsContext*, const TextRunPaintInfo&, const FloatPoint&, CustomFontNotReadyAction = DoNotPaintIfFontNotReady) const; 98 void drawText(GraphicsContext*, const TextRunPaintInfo&, const FloatPoint&, CustomFontNotReadyAction = DoNotPaintIfFontNotReady) const;
99 void drawEmphasisMarks(GraphicsContext*, const TextRunPaintInfo&, const Atom icString& mark, const FloatPoint&) const; 99 void drawEmphasisMarks(GraphicsContext*, const TextRunPaintInfo&, const Atom icString& mark, const FloatPoint&) const;
100 100
101 float width(const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const; 101 float width(const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const;
102 float width(const TextRun&, int& charsConsumed, Glyph& glyphId) const; 102 float width(const TextRun&, int& charsConsumed, Glyph& glyphId) const;
103 103
104 int offsetForPosition(const TextRun&, float position, bool includePartialGly phs) const; 104 int offsetForPosition(const TextRun&, float position, bool includePartialGly phs) const;
105 FloatRect selectionRectForText(const TextRun&, const FloatPoint&, int h, int from = 0, int to = -1) const; 105 FloatRect selectionRectForText(const TextRun&, const FloatPoint&, int h, int from = 0, int to = -1, bool accountForGlyphBounds = false) const;
106 106
107 bool isFixedPitch() const; 107 bool isFixedPitch() const;
108 108
109 // Metrics that we query the FontFallbackList for. 109 // Metrics that we query the FontFallbackList for.
110 const FontMetrics& fontMetrics() const { return primaryFont()->fontMetrics() ; } 110 const FontMetrics& fontMetrics() const { return primaryFont()->fontMetrics() ; }
111 float spaceWidth() const { return primaryFont()->spaceWidth() + fontDescript ion().letterSpacing(); } 111 float spaceWidth() const { return primaryFont()->spaceWidth() + fontDescript ion().letterSpacing(); }
112 float tabWidth(const SimpleFontData&, unsigned tabSize, float position) cons t; 112 float tabWidth(const SimpleFontData&, unsigned tabSize, float position) cons t;
113 float tabWidth(unsigned tabSize, float position) const { return tabWidth(*pr imaryFont(), tabSize, position); } 113 float tabWidth(unsigned tabSize, float position) const { return tabWidth(*pr imaryFont(), tabSize, position); }
114 114
115 int emphasisMarkAscent(const AtomicString&) const; 115 int emphasisMarkAscent(const AtomicString&) const;
(...skipping 19 matching lines...) Expand all
135 135
136 // Returns the initial in-stream advance. 136 // Returns the initial in-stream advance.
137 float getGlyphsAndAdvancesForSimpleText(const TextRun&, int from, int to, Gl yphBuffer&, ForTextEmphasisOrNot = NotForTextEmphasis) const; 137 float getGlyphsAndAdvancesForSimpleText(const TextRun&, int from, int to, Gl yphBuffer&, ForTextEmphasisOrNot = NotForTextEmphasis) const;
138 void drawSimpleText(GraphicsContext*, const TextRunPaintInfo&, const FloatPo int&) const; 138 void drawSimpleText(GraphicsContext*, const TextRunPaintInfo&, const FloatPo int&) const;
139 void drawEmphasisMarksForSimpleText(GraphicsContext*, const TextRunPaintInfo &, const AtomicString& mark, const FloatPoint&) const; 139 void drawEmphasisMarksForSimpleText(GraphicsContext*, const TextRunPaintInfo &, const AtomicString& mark, const FloatPoint&) const;
140 void drawGlyphs(GraphicsContext*, const SimpleFontData*, const GlyphBuffer&, unsigned from, unsigned numGlyphs, const FloatPoint&, const FloatRect& textRect ) const; 140 void drawGlyphs(GraphicsContext*, const SimpleFontData*, const GlyphBuffer&, unsigned from, unsigned numGlyphs, const FloatPoint&, const FloatRect& textRect ) const;
141 void drawGlyphBuffer(GraphicsContext*, const TextRunPaintInfo&, const GlyphB uffer&, const FloatPoint&) const; 141 void drawGlyphBuffer(GraphicsContext*, const TextRunPaintInfo&, const GlyphB uffer&, const FloatPoint&) const;
142 void drawEmphasisMarks(GraphicsContext*, const TextRunPaintInfo&, const Glyp hBuffer&, const AtomicString&, const FloatPoint&) const; 142 void drawEmphasisMarks(GraphicsContext*, const TextRunPaintInfo&, const Glyp hBuffer&, const AtomicString&, const FloatPoint&) const;
143 float floatWidthForSimpleText(const TextRun&, HashSet<const SimpleFontData*> * fallbackFonts = 0, GlyphOverflow* = 0) const; 143 float floatWidthForSimpleText(const TextRun&, HashSet<const SimpleFontData*> * fallbackFonts = 0, GlyphOverflow* = 0) const;
144 int offsetForPositionForSimpleText(const TextRun&, float position, bool incl udePartialGlyphs) const; 144 int offsetForPositionForSimpleText(const TextRun&, float position, bool incl udePartialGlyphs) const;
145 FloatRect selectionRectForSimpleText(const TextRun&, const FloatPoint&, int h, int from, int to) const; 145 FloatRect selectionRectForSimpleText(const TextRun&, const FloatPoint&, int h, int from, int to, bool accountForGlyphBounds) const;
146 146
147 bool getEmphasisMarkGlyphData(const AtomicString&, GlyphData&) const; 147 bool getEmphasisMarkGlyphData(const AtomicString&, GlyphData&) const;
148 148
149 // Returns the initial in-stream advance. 149 // Returns the initial in-stream advance.
150 float getGlyphsAndAdvancesForComplexText(const TextRun&, int from, int to, G lyphBuffer&, ForTextEmphasisOrNot = NotForTextEmphasis) const; 150 float getGlyphsAndAdvancesForComplexText(const TextRun&, int from, int to, G lyphBuffer&, ForTextEmphasisOrNot = NotForTextEmphasis) const;
151 void drawComplexText(GraphicsContext*, const TextRunPaintInfo&, const FloatP oint&) const; 151 void drawComplexText(GraphicsContext*, const TextRunPaintInfo&, const FloatP oint&) const;
152 void drawEmphasisMarksForComplexText(GraphicsContext*, const TextRunPaintInf o&, const AtomicString& mark, const FloatPoint&) const; 152 void drawEmphasisMarksForComplexText(GraphicsContext*, const TextRunPaintInf o&, const AtomicString& mark, const FloatPoint&) const;
153 float floatWidthForComplexText(const TextRun&, HashSet<const SimpleFontData* >* fallbackFonts = 0, GlyphOverflow* = 0) const; 153 float floatWidthForComplexText(const TextRun&, HashSet<const SimpleFontData* >* fallbackFonts = 0, GlyphOverflow* = 0) const;
154 int offsetForPositionForComplexText(const TextRun&, float position, bool inc ludePartialGlyphs) const; 154 int offsetForPositionForComplexText(const TextRun&, float position, bool inc ludePartialGlyphs) const;
155 FloatRect selectionRectForComplexText(const TextRun&, const FloatPoint&, int h, int from, int to) const; 155 FloatRect selectionRectForComplexText(const TextRun&, const FloatPoint&, int h, int from, int to) const;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 { 215 {
216 if (!tabSize) 216 if (!tabSize)
217 return fontDescription().letterSpacing(); 217 return fontDescription().letterSpacing();
218 float tabWidth = tabSize * fontData.spaceWidth() + fontDescription().letterS pacing(); 218 float tabWidth = tabSize * fontData.spaceWidth() + fontDescription().letterS pacing();
219 return tabWidth - fmodf(position, tabWidth); 219 return tabWidth - fmodf(position, tabWidth);
220 } 220 }
221 221
222 } 222 }
223 223
224 #endif 224 #endif
OLDNEW
« no previous file with comments | « Source/core/html/canvas/CanvasRenderingContext2D.cpp ('k') | Source/platform/fonts/Font.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698