Index: third_party/WebKit/Source/platform/fonts/FontDescription.h |
diff --git a/third_party/WebKit/Source/platform/fonts/FontDescription.h b/third_party/WebKit/Source/platform/fonts/FontDescription.h |
index b0513fa050b123fc2014a8663ac1a10e5e899efd..2bd23994b0e35a25a4d328be3db0a71818da536a 100644 |
--- a/third_party/WebKit/Source/platform/fonts/FontDescription.h |
+++ b/third_party/WebKit/Source/platform/fonts/FontDescription.h |
@@ -30,6 +30,7 @@ |
#include "platform/fonts/FontCacheKey.h" |
#include "platform/fonts/FontFamily.h" |
#include "platform/fonts/FontFeatureSettings.h" |
+#include "platform/fonts/FontLocale.h" |
#include "platform/fonts/FontOrientation.h" |
#include "platform/fonts/FontSmoothingMode.h" |
#include "platform/fonts/FontTraits.h" |
@@ -37,7 +38,6 @@ |
#include "platform/fonts/FontWidthVariant.h" |
#include "platform/fonts/TextRenderingMode.h" |
#include "platform/fonts/TypesettingFeatures.h" |
-#include "platform/text/LocaleToScriptMapping.h" |
#include "wtf/Allocator.h" |
#include "wtf/MathExtras.h" |
@@ -90,7 +90,6 @@ public: |
m_fields.m_keywordSize = 0; |
m_fields.m_fontSmoothing = AutoSmoothing; |
m_fields.m_textRendering = AutoTextRendering; |
- m_fields.m_script = USCRIPT_COMMON; |
m_fields.m_syntheticBold = false; |
m_fields.m_syntheticItalic = false; |
m_fields.m_subpixelTextPosition = s_useSubpixelTextPositioning; |
@@ -178,8 +177,10 @@ public: |
unsigned keywordSize() const { return m_fields.m_keywordSize; } |
FontSmoothingMode fontSmoothing() const { return static_cast<FontSmoothingMode>(m_fields.m_fontSmoothing); } |
TextRenderingMode textRendering() const { return static_cast<TextRenderingMode>(m_fields.m_textRendering); } |
- UScriptCode script() const { return static_cast<UScriptCode>(m_fields.m_script); } |
- const AtomicString& locale(bool includeDefault = true) const; |
+ const FontLocale& localeOrDefault() const { return m_locale ? *m_locale : FontLocale::getDefault(); } |
+ const FontLocale* locale() const { return m_locale.get(); } |
drott
2016/07/19 15:28:53
Perhaps we can reduce this to one method on FontDe
kojii
2016/07/20 06:01:53
Thanks, that's a good idea, added static methods a
drott
2016/07/21 09:23:49
Sounds good to me.
|
+ const AtomicString& localeString() const { return m_locale ? m_locale->localeString() : nullAtom; } |
+ UScriptCode script() const { return localeOrDefault().script(); } |
bool isSyntheticBold() const { return m_fields.m_syntheticBold; } |
bool isSyntheticItalic() const { return m_fields.m_syntheticItalic; } |
bool useSubpixelPositioning() const { return m_fields.m_subpixelTextPosition; } |
@@ -217,11 +218,7 @@ public: |
void setTextRendering(TextRenderingMode rendering) { m_fields.m_textRendering = rendering; updateTypesettingFeatures(); } |
void setOrientation(FontOrientation orientation) { m_fields.m_orientation = static_cast<unsigned>(orientation); } |
void setWidthVariant(FontWidthVariant widthVariant) { m_fields.m_widthVariant = widthVariant; } |
- void setLocale(const AtomicString& locale) |
- { |
- m_locale = locale; |
- m_fields.m_script = localeToScriptCodeForFontSelection(locale); |
drott
2016/07/19 15:28:53
Good to see this going away.
|
- } |
+ void setLocale(PassRefPtr<const FontLocale> locale) { m_locale = locale; } |
void setSyntheticBold(bool syntheticBold) { m_fields.m_syntheticBold = syntheticBold; } |
void setSyntheticItalic(bool syntheticItalic) { m_fields.m_syntheticItalic = syntheticItalic; } |
void setFeatureSettings(PassRefPtr<FontFeatureSettings> settings) { m_featureSettings = settings; } |
@@ -248,7 +245,7 @@ public: |
private: |
FontFamily m_familyList; // The list of font families to be used. |
RefPtr<FontFeatureSettings> m_featureSettings; |
- AtomicString m_locale; |
+ RefPtr<const FontLocale> m_locale; |
void updateTypesettingFeatures(); |
@@ -294,7 +291,6 @@ private: |
unsigned m_fontSmoothing : 2; // FontSmoothingMode |
unsigned m_textRendering : 2; // TextRenderingMode |
- unsigned m_script : 7; // Used to help choose an appropriate font for generic font families. |
unsigned m_syntheticBold : 1; |
unsigned m_syntheticItalic : 1; |
unsigned m_subpixelTextPosition : 1; |