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

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

Issue 2392033002: Correcting text baseline for tiny fonts (Closed)
Patch Set: Rebaseline. Created 4 years, 2 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 * 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.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 SmallCapsVariant, 53 SmallCapsVariant,
54 EmphasisMarkVariant 54 EmphasisMarkVariant
55 }; 55 };
56 56
57 class PLATFORM_EXPORT SimpleFontData : public FontData { 57 class PLATFORM_EXPORT SimpleFontData : public FontData {
58 public: 58 public:
59 // Used to create platform fonts. 59 // Used to create platform fonts.
60 static PassRefPtr<SimpleFontData> create( 60 static PassRefPtr<SimpleFontData> create(
61 const FontPlatformData& platformData, 61 const FontPlatformData& platformData,
62 PassRefPtr<CustomFontData> customData = nullptr, 62 PassRefPtr<CustomFontData> customData = nullptr,
63 bool isTextOrientationFallback = false) { 63 bool isTextOrientationFallback = false,
64 bool subpixelAscentDescent = false) {
64 return adoptRef(new SimpleFontData(platformData, std::move(customData), 65 return adoptRef(new SimpleFontData(platformData, std::move(customData),
65 isTextOrientationFallback)); 66 isTextOrientationFallback,
67 subpixelAscentDescent));
66 } 68 }
67 69
68 ~SimpleFontData() override; 70 ~SimpleFontData() override;
69 71
70 const FontPlatformData& platformData() const { return m_platformData; } 72 const FontPlatformData& platformData() const { return m_platformData; }
71 const OpenTypeVerticalData* verticalData() const { 73 const OpenTypeVerticalData* verticalData() const {
72 return m_verticalData.get(); 74 return m_verticalData.get();
73 } 75 }
74 76
75 PassRefPtr<SimpleFontData> smallCapsFontData(const FontDescription&) const; 77 PassRefPtr<SimpleFontData> smallCapsFontData(const FontDescription&) const;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 // Implemented by the platform. 156 // Implemented by the platform.
155 virtual bool fillGlyphPage(GlyphPage* pageToFill, 157 virtual bool fillGlyphPage(GlyphPage* pageToFill,
156 unsigned offset, 158 unsigned offset,
157 unsigned length, 159 unsigned length,
158 UChar* buffer, 160 UChar* buffer,
159 unsigned bufferLength) const; 161 unsigned bufferLength) const;
160 162
161 protected: 163 protected:
162 SimpleFontData(const FontPlatformData&, 164 SimpleFontData(const FontPlatformData&,
163 PassRefPtr<CustomFontData> customData, 165 PassRefPtr<CustomFontData> customData,
164 bool isTextOrientationFallback = false); 166 bool isTextOrientationFallback = false,
167 bool subpixelAscentDescent = false);
165 168
166 SimpleFontData(PassRefPtr<CustomFontData> customData, 169 SimpleFontData(PassRefPtr<CustomFontData> customData,
167 float fontSize, 170 float fontSize,
168 bool syntheticBold, 171 bool syntheticBold,
169 bool syntheticItalic); 172 bool syntheticItalic);
170 173
171 private: 174 private:
172 void platformInit(); 175 void platformInit(bool subpixelAscentDescent);
173 void platformGlyphInit(); 176 void platformGlyphInit();
174 177
175 PassRefPtr<SimpleFontData> createScaledFontData(const FontDescription&, 178 PassRefPtr<SimpleFontData> createScaledFontData(const FontDescription&,
176 float scaleFactor) const; 179 float scaleFactor) const;
177 180
178 FontMetrics m_fontMetrics; 181 FontMetrics m_fontMetrics;
179 float m_maxCharWidth; 182 float m_maxCharWidth;
180 float m_avgCharWidth; 183 float m_avgCharWidth;
181 184
182 FontPlatformData m_platformData; 185 FontPlatformData m_platformData;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 259
257 m_glyphToWidthMap.setMetricsForGlyph(glyph, width); 260 m_glyphToWidthMap.setMetricsForGlyph(glyph, width);
258 return width; 261 return width;
259 #endif 262 #endif
260 } 263 }
261 264
262 DEFINE_FONT_DATA_TYPE_CASTS(SimpleFontData, false); 265 DEFINE_FONT_DATA_TYPE_CASTS(SimpleFontData, false);
263 266
264 } // namespace blink 267 } // namespace blink
265 #endif // SimpleFontData_h 268 #endif // SimpleFontData_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698