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

Side by Side Diff: third_party/WebKit/Source/platform/fonts/FontDescription.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 * 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, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights
6 * reserved. 6 * reserved.
7 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 7 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 m_fields.m_historicalLigaturesState = NormalLigaturesState; 107 m_fields.m_historicalLigaturesState = NormalLigaturesState;
108 m_fields.m_contextualLigaturesState = NormalLigaturesState; 108 m_fields.m_contextualLigaturesState = NormalLigaturesState;
109 m_fields.m_keywordSize = 0; 109 m_fields.m_keywordSize = 0;
110 m_fields.m_fontSmoothing = AutoSmoothing; 110 m_fields.m_fontSmoothing = AutoSmoothing;
111 m_fields.m_textRendering = AutoTextRendering; 111 m_fields.m_textRendering = AutoTextRendering;
112 m_fields.m_syntheticBold = false; 112 m_fields.m_syntheticBold = false;
113 m_fields.m_syntheticItalic = false; 113 m_fields.m_syntheticItalic = false;
114 m_fields.m_subpixelTextPosition = s_useSubpixelTextPositioning; 114 m_fields.m_subpixelTextPosition = s_useSubpixelTextPositioning;
115 m_fields.m_typesettingFeatures = s_defaultTypesettingFeatures; 115 m_fields.m_typesettingFeatures = s_defaultTypesettingFeatures;
116 m_fields.m_variantNumeric = FontVariantNumeric().m_fieldsAsUnsigned; 116 m_fields.m_variantNumeric = FontVariantNumeric().m_fieldsAsUnsigned;
117 m_fields.m_subpixelAscentDescent = false;
117 } 118 }
118 119
119 bool operator==(const FontDescription&) const; 120 bool operator==(const FontDescription&) const;
120 bool operator!=(const FontDescription& other) const { 121 bool operator!=(const FontDescription& other) const {
121 return !(*this == other); 122 return !(*this == other);
122 } 123 }
123 124
124 struct VariantLigatures { 125 struct VariantLigatures {
125 STACK_ALLOCATED(); 126 STACK_ALLOCATED();
126 VariantLigatures(LigaturesState state = NormalLigaturesState) 127 VariantLigatures(LigaturesState state = NormalLigaturesState)
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 314
314 TypesettingFeatures getTypesettingFeatures() const { 315 TypesettingFeatures getTypesettingFeatures() const {
315 return static_cast<TypesettingFeatures>(m_fields.m_typesettingFeatures); 316 return static_cast<TypesettingFeatures>(m_fields.m_typesettingFeatures);
316 } 317 }
317 318
318 static void setSubpixelPositioning(bool b) { 319 static void setSubpixelPositioning(bool b) {
319 s_useSubpixelTextPositioning = b; 320 s_useSubpixelTextPositioning = b;
320 } 321 }
321 static bool subpixelPositioning() { return s_useSubpixelTextPositioning; } 322 static bool subpixelPositioning() { return s_useSubpixelTextPositioning; }
322 323
324 void setSubpixelAscentDescent(bool sp) const {
325 m_fields.m_subpixelAscentDescent = sp;
326 }
327
328 bool subpixelAscentDescent() const {
329 return m_fields.m_subpixelAscentDescent;
330 }
331
323 static void setDefaultTypesettingFeatures(TypesettingFeatures); 332 static void setDefaultTypesettingFeatures(TypesettingFeatures);
324 static TypesettingFeatures defaultTypesettingFeatures(); 333 static TypesettingFeatures defaultTypesettingFeatures();
325 334
326 unsigned styleHashWithoutFamilyList() const; 335 unsigned styleHashWithoutFamilyList() const;
327 // TODO(drott): We should not expose internal structure here, but rather 336 // TODO(drott): We should not expose internal structure here, but rather
328 // introduce a hash function here. 337 // introduce a hash function here.
329 unsigned bitmapFields() const { return m_fieldsAsUnsigned.parts[0]; } 338 unsigned bitmapFields() const { return m_fieldsAsUnsigned.parts[0]; }
330 unsigned auxiliaryBitmapFields() const { return m_fieldsAsUnsigned.parts[1]; } 339 unsigned auxiliaryBitmapFields() const { return m_fieldsAsUnsigned.parts[1]; }
331 340
332 SkFontStyle skiaFontStyle() const; 341 SkFontStyle skiaFontStyle() const;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 // values for <font>). 393 // values for <font>).
385 unsigned m_keywordSize : 4; 394 unsigned m_keywordSize : 4;
386 395
387 unsigned m_fontSmoothing : 2; // FontSmoothingMode 396 unsigned m_fontSmoothing : 2; // FontSmoothingMode
388 unsigned m_textRendering : 2; // TextRenderingMode 397 unsigned m_textRendering : 2; // TextRenderingMode
389 unsigned m_syntheticBold : 1; 398 unsigned m_syntheticBold : 1;
390 unsigned m_syntheticItalic : 1; 399 unsigned m_syntheticItalic : 1;
391 unsigned m_subpixelTextPosition : 1; 400 unsigned m_subpixelTextPosition : 1;
392 unsigned m_typesettingFeatures : 3; 401 unsigned m_typesettingFeatures : 3;
393 unsigned m_variantNumeric : 8; 402 unsigned m_variantNumeric : 8;
403 mutable unsigned m_subpixelAscentDescent : 1;
394 }; 404 };
395 405
396 static_assert(sizeof(BitFields) == sizeof(FieldsAsUnsignedType), 406 static_assert(sizeof(BitFields) == sizeof(FieldsAsUnsignedType),
397 "Mapped bitfield datatypes must have identical size."); 407 "Mapped bitfield datatypes must have identical size.");
398 union { 408 union {
399 BitFields m_fields; 409 BitFields m_fields;
400 FieldsAsUnsignedType m_fieldsAsUnsigned; 410 FieldsAsUnsignedType m_fieldsAsUnsigned;
401 }; 411 };
402 412
403 static TypesettingFeatures s_defaultTypesettingFeatures; 413 static TypesettingFeatures s_defaultTypesettingFeatures;
(...skipping 12 matching lines...) Expand all
416 m_fieldsAsUnsigned.parts[0] == other.m_fieldsAsUnsigned.parts[0] && 426 m_fieldsAsUnsigned.parts[0] == other.m_fieldsAsUnsigned.parts[0] &&
417 m_fieldsAsUnsigned.parts[1] == other.m_fieldsAsUnsigned.parts[1] && 427 m_fieldsAsUnsigned.parts[1] == other.m_fieldsAsUnsigned.parts[1] &&
418 (m_featureSettings == other.m_featureSettings || 428 (m_featureSettings == other.m_featureSettings ||
419 (m_featureSettings && other.m_featureSettings && 429 (m_featureSettings && other.m_featureSettings &&
420 *m_featureSettings == *other.m_featureSettings)); 430 *m_featureSettings == *other.m_featureSettings));
421 } 431 }
422 432
423 } // namespace blink 433 } // namespace blink
424 434
425 #endif 435 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698