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

Side by Side Diff: third_party/WebKit/WebCore/platform/graphics/SimpleFontData.h

Issue 18529: Removing unneeded code from SimpleFontData. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | third_party/WebKit/WebCore/platform/graphics/SimpleFontData.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 * This file is part of the internal font implementation. 2 * This file is part of the internal font implementation.
3 * 3 *
4 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 4 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include <QFont> 45 #include <QFont>
46 #endif 46 #endif
47 47
48 namespace WebCore { 48 namespace WebCore {
49 49
50 class FontDescription; 50 class FontDescription;
51 class FontPlatformData; 51 class FontPlatformData;
52 class SharedBuffer; 52 class SharedBuffer;
53 class SVGFontData; 53 class SVGFontData;
54 class WidthMap; 54 class WidthMap;
55 class ZeroWidthFontData;
56 class CJKWidthFontData;
57 55
58 enum Pitch { UnknownPitch, FixedPitch, VariablePitch }; 56 enum Pitch { UnknownPitch, FixedPitch, VariablePitch };
59 57
60 class SimpleFontData : public FontData { 58 class SimpleFontData : public FontData {
61 public: 59 public:
62 SimpleFontData(const FontPlatformData&, bool customFont = false, bool loadin g = false, SVGFontData* data = 0); 60 SimpleFontData(const FontPlatformData&, bool customFont = false, bool loadin g = false, SVGFontData* data = 0);
63 virtual ~SimpleFontData(); 61 virtual ~SimpleFontData();
64 62
65 protected:
66 // sub-class constructor
67 SimpleFontData();
68
69 public: 63 public:
70 const FontPlatformData& platformData() const { return m_font; } 64 const FontPlatformData& platformData() const { return m_font; }
71 SimpleFontData* smallCapsFontData(const FontDescription& fontDescription) co nst; 65 SimpleFontData* smallCapsFontData(const FontDescription& fontDescription) co nst;
72 66
73 // vertical metrics 67 // vertical metrics
74 int ascent() const { return m_ascent; } 68 int ascent() const { return m_ascent; }
75 int descent() const { return m_descent; } 69 int descent() const { return m_descent; }
76 int lineSpacing() const { return m_lineSpacing; } 70 int lineSpacing() const { return m_lineSpacing; }
77 int lineGap() const { return m_lineGap; } 71 int lineGap() const { return m_lineGap; }
78 int maxCharWidth() const { return m_maxCharWidth; } 72 int maxCharWidth() const { return m_maxCharWidth; }
79 int avgCharWidth() const { return m_avgCharWidth; } 73 int avgCharWidth() const { return m_avgCharWidth; }
80 74
81 float xHeight() const { return m_xHeight; } 75 float xHeight() const { return m_xHeight; }
82 unsigned unitsPerEm() const { return m_unitsPerEm; } 76 unsigned unitsPerEm() const { return m_unitsPerEm; }
83 77
84 virtual float widthForGlyph(Glyph) const; 78 float widthForGlyph(Glyph) const;
85 float platformWidthForGlyph(Glyph) const; 79 float platformWidthForGlyph(Glyph) const;
86 80
87 virtual const SimpleFontData* fontDataForCharacter(UChar32) const; 81 virtual const SimpleFontData* fontDataForCharacter(UChar32) const;
88 virtual bool containsCharacters(const UChar*, int length) const; 82 virtual bool containsCharacters(const UChar*, int length) const;
89 83
90 void determinePitch(); 84 void determinePitch();
91 Pitch pitch() const { return m_treatAsFixedPitch ? FixedPitch : VariablePitc h; } 85 Pitch pitch() const { return m_treatAsFixedPitch ? FixedPitch : VariablePitc h; }
92 86
93 static bool isCJKCodePoint(UChar32 c);
94
95 #if ENABLE(SVG_FONTS) 87 #if ENABLE(SVG_FONTS)
96 SVGFontData* svgFontData() const { return m_svgFontData.get(); } 88 SVGFontData* svgFontData() const { return m_svgFontData.get(); }
97 bool isSVGFont() const { return m_svgFontData; } 89 bool isSVGFont() const { return m_svgFontData; }
98 #else 90 #else
99 bool isSVGFont() const { return false; } 91 bool isSVGFont() const { return false; }
100 #endif 92 #endif
101 93
102 virtual bool isCustomFont() const { return m_isCustomFont; } 94 virtual bool isCustomFont() const { return m_isCustomFont; }
103 virtual bool isLoading() const { return m_isLoading; } 95 virtual bool isLoading() const { return m_isLoading; }
104 virtual bool isSegmented() const; 96 virtual bool isSegmented() const;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 #endif 130 #endif
139 131
140 #if PLATFORM(GTK) && PLATFORM(CAIRO) 132 #if PLATFORM(GTK) && PLATFORM(CAIRO)
141 void setFont(cairo_t*) const; 133 void setFont(cairo_t*) const;
142 #endif 134 #endif
143 135
144 #if PLATFORM(WX) 136 #if PLATFORM(WX)
145 wxFont getWxFont() const { return m_font.font(); } 137 wxFont getWxFont() const { return m_font.font(); }
146 #endif 138 #endif
147 139
148 const SimpleFontData* zeroWidthFontData() const;
149 const SimpleFontData* cjkWidthFontData() const;
150
151 private: 140 private:
152 void platformInit(); 141 void platformInit();
153 void platformGlyphInit(); 142 void platformGlyphInit();
154 void platformDestroy(); 143 void platformDestroy();
155 144
156 void commonInit(); 145 void commonInit();
157 146
158 #if PLATFORM(WIN) 147 #if PLATFORM(WIN)
159 void initGDIFont(); 148 void initGDIFont();
160 void platformCommonDestroy(); 149 void platformCommonDestroy();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 #if USE(CORE_TEXT) 202 #if USE(CORE_TEXT)
214 mutable RetainPtr<CTFontRef> m_CTFont; 203 mutable RetainPtr<CTFontRef> m_CTFont;
215 mutable RetainPtr<CFDictionaryRef> m_CFStringAttributes; 204 mutable RetainPtr<CFDictionaryRef> m_CFStringAttributes;
216 #endif 205 #endif
217 206
218 #if PLATFORM(WIN) 207 #if PLATFORM(WIN)
219 bool m_isSystemFont; 208 bool m_isSystemFont;
220 mutable SCRIPT_CACHE m_scriptCache; 209 mutable SCRIPT_CACHE m_scriptCache;
221 mutable SCRIPT_FONTPROPERTIES* m_scriptFontProperties; 210 mutable SCRIPT_FONTPROPERTIES* m_scriptFontProperties;
222 #endif 211 #endif
223
224 private:
225 OwnPtr<ZeroWidthFontData> m_zeroWidthFontData;
226 OwnPtr<CJKWidthFontData> m_cjkWidthFontData;
227 };
228
229 // SimpleFontData sub-classes:
230
231 // Has a single zero-width glyph, used for ZWS and
232 // UCHAR_DEFAULT_IGNORABLE_CODE_POINT characters
233 class ZeroWidthFontData : public SimpleFontData {
234 public:
235 void init(SimpleFontData*);
236 virtual float widthForGlyph(Glyph) const { return 0.0f; }
237 };
238
239 // Monospaced, single glyph and width, used for CJK characters
240 // The assumption made here can break for some high-quality CJK fonts with
241 // proportional CJK glyphs.
242 class CJKWidthFontData : public ZeroWidthFontData {
243 public:
244 CJKWidthFontData();
245
246 virtual float widthForGlyph(Glyph) const;
247
248 private:
249 // Optimization for CJK glyphs
250 mutable float m_cjkGlyphWidth;
251 }; 212 };
252 213
253 } // namespace WebCore 214 } // namespace WebCore
254 215
255 #endif // SimpleFontData_h 216 #endif // SimpleFontData_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/WebCore/platform/graphics/SimpleFontData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698