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

Unified Diff: Source/platform/fonts/Font.cpp

Issue 1206883002: Fix default text orientation that do not conform Unicode Technical Report #50 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/fonts/Character.cpp ('k') | Source/platform/fonts/FontDescription.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/fonts/Font.cpp
diff --git a/Source/platform/fonts/Font.cpp b/Source/platform/fonts/Font.cpp
index e1f1b5fcf9ab301a38c8b9f50254ab5b9154a634..1ea158104f9d460c131f05ae3a9a700160a2b633 100644
--- a/Source/platform/fonts/Font.cpp
+++ b/Source/platform/fonts/Font.cpp
@@ -344,9 +344,9 @@ void Font::willUseFontData(UChar32 character) const
m_fontFallbackList->fontSelector()->willUseFontData(fontDescription(), family.family(), character);
}
-static inline GlyphData glyphDataForNonCJKCharacterWithGlyphOrientation(UChar32 character, FontOrientation orientation, GlyphData& data, unsigned pageNumber)
+static inline GlyphData glyphDataForNonCJKCharacterWithGlyphOrientation(UChar32 character, bool isUpright, GlyphData& data, unsigned pageNumber)
{
- if (isVerticalNonCJKUpright(orientation) || Character::shouldIgnoreRotation(character)) {
+ if (isUpright) {
RefPtr<SimpleFontData> uprightFontData = data.fontData->uprightOrientationFontData();
GlyphPageTreeNode* uprightNode = GlyphPageTreeNode::getNormalRootChild(uprightFontData.get(), pageNumber);
GlyphPage* uprightPage = uprightNode->page();
@@ -418,11 +418,12 @@ GlyphData Font::glyphDataForCharacter(UChar32& c, bool mirror, bool normalizeSpa
page = node->page(m_fontDescription.script());
if (page) {
GlyphData data = page->glyphDataForCharacter(c);
- if (data.fontData && (!data.fontData->platformData().isVerticalAnyUpright() || data.fontData->isTextOrientationFallback()))
- return data;
-
if (data.fontData) {
- if (Character::isCJKIdeographOrSymbol(c)) {
+ if (!data.fontData->platformData().isVerticalAnyUpright() || data.fontData->isTextOrientationFallback())
+ return data;
+
+ bool isUpright = m_fontDescription.isVerticalUpright(c);
+ if (isUpright && Character::isCJKIdeographOrSymbol(c)) {
if (!data.fontData->hasVerticalGlyphs()) {
// Use the broken ideograph font data. The broken ideograph font will use the horizontal width of glyphs
// to make sure you get a square (even for broken glyphs like symbols used for punctuation).
@@ -430,7 +431,7 @@ GlyphData Font::glyphDataForCharacter(UChar32& c, bool mirror, bool normalizeSpa
break;
}
} else {
- return glyphDataForNonCJKCharacterWithGlyphOrientation(c, m_fontDescription.orientation(), data, pageNumber);
+ return glyphDataForNonCJKCharacterWithGlyphOrientation(c, isUpright, data, pageNumber);
}
return data;
@@ -511,8 +512,8 @@ GlyphData Font::glyphDataForCharacter(UChar32& c, bool mirror, bool normalizeSpa
if (variant == NormalVariant) {
page->setGlyphDataForCharacter(c, data.glyph, data.fontData);
data.fontData->setMaxGlyphPageTreeLevel(std::max(data.fontData->maxGlyphPageTreeLevel(), node->level()));
- if (!Character::isCJKIdeographOrSymbol(c) && data.fontData->platformData().isVerticalAnyUpright() && !data.fontData->isTextOrientationFallback())
- return glyphDataForNonCJKCharacterWithGlyphOrientation(c, m_fontDescription.orientation(), data, pageNumber);
+ if (data.fontData->platformData().isVerticalAnyUpright() && !data.fontData->isTextOrientationFallback() && !Character::isCJKIdeographOrSymbol(c))
+ return glyphDataForNonCJKCharacterWithGlyphOrientation(c, m_fontDescription.isVerticalUpright(c), data, pageNumber);
}
return data;
}
« no previous file with comments | « Source/platform/fonts/Character.cpp ('k') | Source/platform/fonts/FontDescription.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698