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

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

Issue 1020833002: Remove duplicate Enum Font Pitch (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebasing patch Created 5 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/platform/fonts/FontFallbackList.cpp ('k') | Source/platform/fonts/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, 2010 Apple Inc. All rights reserved. 4 * Copyright (C) 2006, 2008, 2010 Apple Inc. All rights reserved.
5 * Copyright (C) 2007-2008 Torch Mobile, Inc. 5 * Copyright (C) 2007-2008 Torch Mobile, Inc.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
11 * 11 *
12 * This library is distributed in the hope that it will be useful, 12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details. 15 * Library General Public License for more details.
16 * 16 *
17 * You should have received a copy of the GNU Library General Public License 17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to 18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA. 20 * Boston, MA 02110-1301, USA.
21 * 21 *
22 */ 22 */
23 23
24 #ifndef SimpleFontData_h 24 #ifndef SimpleFontData_h
25 #define SimpleFontData_h 25 #define SimpleFontData_h
26 26
27 #include "platform/PlatformExport.h" 27 #include "platform/PlatformExport.h"
28 #include "platform/fonts/CustomFontData.h" 28 #include "platform/fonts/CustomFontData.h"
29 #include "platform/fonts/FixedPitchFontType.h"
29 #include "platform/fonts/FontBaseline.h" 30 #include "platform/fonts/FontBaseline.h"
30 #include "platform/fonts/FontData.h" 31 #include "platform/fonts/FontData.h"
31 #include "platform/fonts/FontMetrics.h" 32 #include "platform/fonts/FontMetrics.h"
32 #include "platform/fonts/FontPlatformData.h" 33 #include "platform/fonts/FontPlatformData.h"
33 #include "platform/fonts/GlyphMetricsMap.h" 34 #include "platform/fonts/GlyphMetricsMap.h"
34 #include "platform/fonts/GlyphPageTreeNode.h" 35 #include "platform/fonts/GlyphPageTreeNode.h"
35 #include "platform/fonts/TypesettingFeatures.h" 36 #include "platform/fonts/TypesettingFeatures.h"
36 #include "platform/fonts/opentype/OpenTypeVerticalData.h" 37 #include "platform/fonts/opentype/OpenTypeVerticalData.h"
37 #include "platform/geometry/FloatRect.h" 38 #include "platform/geometry/FloatRect.h"
38 #include "wtf/OwnPtr.h" 39 #include "wtf/OwnPtr.h"
39 #include "wtf/PassOwnPtr.h" 40 #include "wtf/PassOwnPtr.h"
40 #include "wtf/text/StringHash.h" 41 #include "wtf/text/StringHash.h"
41 42
42 #if OS(MACOSX) 43 #if OS(MACOSX)
43 #include "wtf/RetainPtr.h" 44 #include "wtf/RetainPtr.h"
44 #endif 45 #endif
45 46
46 namespace blink { 47 namespace blink {
47 48
48 class FontDescription; 49 class FontDescription;
49 50
50 enum FontDataVariant { AutoVariant, NormalVariant, SmallCapsVariant, EmphasisMar kVariant, BrokenIdeographVariant }; 51 enum FontDataVariant { AutoVariant, NormalVariant, SmallCapsVariant, EmphasisMar kVariant, BrokenIdeographVariant };
51 enum Pitch { UnknownPitch, FixedPitch, VariablePitch };
52 52
53 class PLATFORM_EXPORT SimpleFontData : public FontData { 53 class PLATFORM_EXPORT SimpleFontData : public FontData {
54 public: 54 public:
55 // Used to create platform fonts. 55 // Used to create platform fonts.
56 static PassRefPtr<SimpleFontData> create(const FontPlatformData& platformDat a, PassRefPtr<CustomFontData> customData = nullptr, bool isTextOrientationFallba ck = false) 56 static PassRefPtr<SimpleFontData> create(const FontPlatformData& platformDat a, PassRefPtr<CustomFontData> customData = nullptr, bool isTextOrientationFallba ck = false)
57 { 57 {
58 return adoptRef(new SimpleFontData(platformData, customData, isTextOrien tationFallback)); 58 return adoptRef(new SimpleFontData(platformData, customData, isTextOrien tationFallback));
59 } 59 }
60 60
61 virtual ~SimpleFontData(); 61 virtual ~SimpleFontData();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 void setZeroWidthSpaceGlyph(Glyph spaceGlyph) { m_zeroWidthSpaceGlyph = spac eGlyph; } 114 void setZeroWidthSpaceGlyph(Glyph spaceGlyph) { m_zeroWidthSpaceGlyph = spac eGlyph; }
115 bool isZeroWidthSpaceGlyph(Glyph glyph) const { return glyph == m_zeroWidthS paceGlyph && glyph; } 115 bool isZeroWidthSpaceGlyph(Glyph glyph) const { return glyph == m_zeroWidthS paceGlyph && glyph; }
116 Glyph zeroGlyph() const { return m_zeroGlyph; } 116 Glyph zeroGlyph() const { return m_zeroGlyph; }
117 void setZeroGlyph(Glyph zeroGlyph) { m_zeroGlyph = zeroGlyph; } 117 void setZeroGlyph(Glyph zeroGlyph) { m_zeroGlyph = zeroGlyph; }
118 118
119 virtual const SimpleFontData* fontDataForCharacter(UChar32) const override; 119 virtual const SimpleFontData* fontDataForCharacter(UChar32) const override;
120 120
121 Glyph glyphForCharacter(UChar32) const; 121 Glyph glyphForCharacter(UChar32) const;
122 122
123 void determinePitch(); 123 void determinePitch();
124 Pitch pitch() const { return m_treatAsFixedPitch ? FixedPitch : VariablePitc h; } 124 FixedPitchFontType pitch() const { return m_pitch; }
125 125
126 virtual bool isCustomFont() const override { return m_customFontData; } 126 virtual bool isCustomFont() const override { return m_customFontData; }
127 virtual bool isLoading() const override { return m_customFontData ? m_custom FontData->isLoading() : false; } 127 virtual bool isLoading() const override { return m_customFontData ? m_custom FontData->isLoading() : false; }
128 virtual bool isLoadingFallback() const override { return m_customFontData ? m_customFontData->isLoadingFallback() : false; } 128 virtual bool isLoadingFallback() const override { return m_customFontData ? m_customFontData->isLoadingFallback() : false; }
129 virtual bool isSegmented() const override; 129 virtual bool isSegmented() const override;
130 virtual bool shouldSkipDrawing() const override { return m_customFontData && m_customFontData->shouldSkipDrawing(); } 130 virtual bool shouldSkipDrawing() const override { return m_customFontData && m_customFontData->shouldSkipDrawing(); }
131 131
132 const GlyphData& missingGlyphData() const { return m_missingGlyphData; } 132 const GlyphData& missingGlyphData() const { return m_missingGlyphData; }
133 void setMissingGlyphData(const GlyphData& glyphData) { m_missingGlyphData = glyphData; } 133 void setMissingGlyphData(const GlyphData& glyphData) { m_missingGlyphData = glyphData; }
134 134
(...skipping 22 matching lines...) Expand all
157 157
158 FontMetrics m_fontMetrics; 158 FontMetrics m_fontMetrics;
159 float m_maxCharWidth; 159 float m_maxCharWidth;
160 float m_avgCharWidth; 160 float m_avgCharWidth;
161 161
162 FontPlatformData m_platformData; 162 FontPlatformData m_platformData;
163 163
164 mutable OwnPtr<GlyphMetricsMap<FloatRect>> m_glyphToBoundsMap; 164 mutable OwnPtr<GlyphMetricsMap<FloatRect>> m_glyphToBoundsMap;
165 mutable GlyphMetricsMap<float> m_glyphToWidthMap; 165 mutable GlyphMetricsMap<float> m_glyphToWidthMap;
166 166
167 bool m_treatAsFixedPitch; 167 FixedPitchFontType m_pitch;
168 168
169 bool m_isTextOrientationFallback; 169 bool m_isTextOrientationFallback;
170 bool m_isBrokenIdeographFallback; 170 bool m_isBrokenIdeographFallback;
171 RefPtr<OpenTypeVerticalData> m_verticalData; 171 RefPtr<OpenTypeVerticalData> m_verticalData;
172 bool m_hasVerticalGlyphs; 172 bool m_hasVerticalGlyphs;
173 173
174 Glyph m_spaceGlyph; 174 Glyph m_spaceGlyph;
175 float m_spaceWidth; 175 float m_spaceWidth;
176 Glyph m_zeroGlyph; 176 Glyph m_zeroGlyph;
177 177
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 width = platformWidthForGlyph(glyph); 234 width = platformWidthForGlyph(glyph);
235 235
236 m_glyphToWidthMap.setMetricsForGlyph(glyph, width); 236 m_glyphToWidthMap.setMetricsForGlyph(glyph, width);
237 return width; 237 return width;
238 } 238 }
239 239
240 DEFINE_FONT_DATA_TYPE_CASTS(SimpleFontData, false); 240 DEFINE_FONT_DATA_TYPE_CASTS(SimpleFontData, false);
241 241
242 } // namespace blink 242 } // namespace blink
243 #endif // SimpleFontData_h 243 #endif // SimpleFontData_h
OLDNEW
« no previous file with comments | « Source/platform/fonts/FontFallbackList.cpp ('k') | Source/platform/fonts/SimpleFontData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698