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

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

Issue 342883004: Using Enum in place of bool for better code readability (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Comment fixes Created 6 years, 5 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 reserv ed. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed.
6 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 6 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
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
11 * version 2 of the License, or (at your option) any later version. 11 * version 2 of the License, or (at your option) any later version.
12 * 12 *
13 * This library is distributed in the hope that it will be useful, 13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details. 16 * Library General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU Library General Public License 18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIother.m_ If not, write to 19 * along with this library; see the file COPYING.LIother.m_ If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USm_ 21 * Boston, MA 02110-1301, USm_
22 * 22 *
23 */ 23 */
24 24
25 #ifndef FontDescription_h 25 #ifndef FontDescription_h
26 #define FontDescription_h 26 #define FontDescription_h
27 27
28 #include "platform/FontFamilyNames.h" 28 #include "platform/FontFamilyNames.h"
29 #include "platform/fonts/FixedPitchFontType.h"
29 #include "platform/fonts/FontCacheKey.h" 30 #include "platform/fonts/FontCacheKey.h"
30 #include "platform/fonts/FontFamily.h" 31 #include "platform/fonts/FontFamily.h"
31 #include "platform/fonts/FontFeatureSettings.h" 32 #include "platform/fonts/FontFeatureSettings.h"
32 #include "platform/fonts/FontOrientation.h" 33 #include "platform/fonts/FontOrientation.h"
33 #include "platform/fonts/FontSmoothingMode.h" 34 #include "platform/fonts/FontSmoothingMode.h"
34 #include "platform/fonts/FontTraits.h" 35 #include "platform/fonts/FontTraits.h"
35 #include "platform/fonts/FontWidthVariant.h" 36 #include "platform/fonts/FontWidthVariant.h"
36 #include "platform/fonts/TextRenderingMode.h" 37 #include "platform/fonts/TextRenderingMode.h"
37 #include "platform/fonts/TypesettingFeatures.h" 38 #include "platform/fonts/TypesettingFeatures.h"
38 #include "platform/text/NonCJKGlyphOrientation.h" 39 #include "platform/text/NonCJKGlyphOrientation.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 int computedPixelSize() const { return int(m_computedSize + 0.5f); } 96 int computedPixelSize() const { return int(m_computedSize + 0.5f); }
96 FontVariant variant() const { return static_cast<FontVariant>(m_variant); } 97 FontVariant variant() const { return static_cast<FontVariant>(m_variant); }
97 bool isAbsoluteSize() const { return m_isAbsoluteSize; } 98 bool isAbsoluteSize() const { return m_isAbsoluteSize; }
98 FontWeight weight() const { return static_cast<FontWeight>(m_weight); } 99 FontWeight weight() const { return static_cast<FontWeight>(m_weight); }
99 FontStretch stretch() const { return static_cast<FontStretch>(m_stretch); } 100 FontStretch stretch() const { return static_cast<FontStretch>(m_stretch); }
100 FontWeight lighterWeight() const; 101 FontWeight lighterWeight() const;
101 FontWeight bolderWeight() const; 102 FontWeight bolderWeight() const;
102 GenericFamilyType genericFamily() const { return static_cast<GenericFamilyTy pe>(m_genericFamily); } 103 GenericFamilyType genericFamily() const { return static_cast<GenericFamilyTy pe>(m_genericFamily); }
103 104
104 // only use fixed default size when there is only one font family, and that family is "monospace" 105 // only use fixed default size when there is only one font family, and that family is "monospace"
105 bool useFixedDefaultSize() const { return genericFamily() == MonospaceFamily && !family().next() && family().family() == FontFamilyNames::webkit_monospace; } 106 FixedPitchFontType fixedPitchFont() const
Inactive 2014/06/27 12:57:53 nit: fixedPitchFontType(). Otherwise it sounds lik
h.joshi 2014/06/30 14:04:15 Done.
107 {
108 if (genericFamily() == MonospaceFamily && !family().next() && family().f amily() == FontFamilyNames::webkit_monospace)
109 return FixedPitchFont;
110 return NonFixedPitchFont;
111 }
106 Kerning kerning() const { return static_cast<Kerning>(m_kerning); } 112 Kerning kerning() const { return static_cast<Kerning>(m_kerning); }
107 LigaturesState commonLigaturesState() const { return static_cast<LigaturesSt ate>(m_commonLigaturesState); } 113 LigaturesState commonLigaturesState() const { return static_cast<LigaturesSt ate>(m_commonLigaturesState); }
108 LigaturesState discretionaryLigaturesState() const { return static_cast<Liga turesState>(m_discretionaryLigaturesState); } 114 LigaturesState discretionaryLigaturesState() const { return static_cast<Liga turesState>(m_discretionaryLigaturesState); }
109 LigaturesState historicalLigaturesState() const { return static_cast<Ligatur esState>(m_historicalLigaturesState); } 115 LigaturesState historicalLigaturesState() const { return static_cast<Ligatur esState>(m_historicalLigaturesState); }
110 LigaturesState contextualLigaturesState() const { return static_cast<Ligatur esState>(m_contextualLigaturesState); } 116 LigaturesState contextualLigaturesState() const { return static_cast<Ligatur esState>(m_contextualLigaturesState); }
111 unsigned keywordSize() const { return m_keywordSize; } 117 unsigned keywordSize() const { return m_keywordSize; }
112 FontSmoothingMode fontSmoothing() const { return static_cast<FontSmoothingMo de>(m_fontSmoothing); } 118 FontSmoothingMode fontSmoothing() const { return static_cast<FontSmoothingMo de>(m_fontSmoothing); }
113 TextRenderingMode textRendering() const { return static_cast<TextRenderingMo de>(m_textRendering); } 119 TextRenderingMode textRendering() const { return static_cast<TextRenderingMo de>(m_textRendering); }
114 UScriptCode script() const { return static_cast<UScriptCode>(m_script); } 120 UScriptCode script() const { return static_cast<UScriptCode>(m_script); }
115 const String& locale() const { return m_locale; } 121 const String& locale() const { return m_locale; }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 && m_script == other.m_script 251 && m_script == other.m_script
246 && m_syntheticBold == other.m_syntheticBold 252 && m_syntheticBold == other.m_syntheticBold
247 && m_syntheticItalic == other.m_syntheticItalic 253 && m_syntheticItalic == other.m_syntheticItalic
248 && m_featureSettings == other.m_featureSettings 254 && m_featureSettings == other.m_featureSettings
249 && m_subpixelTextPosition == other.m_subpixelTextPosition; 255 && m_subpixelTextPosition == other.m_subpixelTextPosition;
250 } 256 }
251 257
252 } 258 }
253 259
254 #endif 260 #endif
OLDNEW
« Source/core/css/CSSComputedStyleDeclaration.cpp ('K') | « Source/platform/fonts/FixedPitchFontType.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698