static inline std::pair<GlyphData, GlyphPage*> glyphDataAndPageForNonCJKCharacterWithGlyphOrientation(UChar32 character, NonCJKGlyphOrientation orientation, GlyphData& data, GlyphPage* page, unsigned pageNumber) { if (orientation == NonCJKGlyphOrientationUpright || shouldIgnoreRotation(character)) { RefPtr<SimpleFontData> uprightFontData = data.fontData->uprightOrientationFontData(); GlyphPageTreeNode* uprightNode = GlyphPageTreeNode::getRootChild(uprightFontData.get(), pageNumber); GlyphPage* uprightPage = uprightNode->page(); if (uprightPage) { GlyphData uprightData = uprightPage->glyphDataForCharacter(character); // If the glyphs are the same, then we know we can just use the horizontal glyph rotated vertically to be upright. if (data.glyph == uprightData.glyph) return std::make_pair(data, page); // The glyphs are distinct, meaning that the font has a vertical-right glyph baked into it. We can't use that // glyph, so we fall back to the upright data and use the horizontal glyph. if (uprightData.fontData) return std::make_pair(uprightData, uprightPage); } } else if (orientation == NonCJKGlyphOrientationVerticalRight) { RefPtr<SimpleFontData> verticalRightFontData = data.fontData->verticalRightOrientationFontData(); GlyphPageTreeNode* verticalRightNode = GlyphPageTreeNode::getRootChild(verticalRightFontData.get(), pageNumber); GlyphPage* verticalRightPage = verticalRightNode->page(); if (verticalRightPage) { GlyphData verticalRightData = verticalRightPage->glyphDataForCharacter(character); // If the glyphs are distinct, we will make the assumption that the font has a vertical-right glyph baked // into it. if (data.glyph != verticalRightData.glyph) return std::make_pair(data, page); // The glyphs are identical, meaning that we should just use the horizontal glyph. if (verticalRightData.fontData) return std::make_pair(verticalRightData, verticalRightPage); } } return std::make_pair(data, page); }
static GlyphData glyphDataForNonCJKCharacterWithGlyphOrientation(UChar32 character, NonCJKGlyphOrientation orientation, const GlyphData& data) { if (orientation == NonCJKGlyphOrientationUpright || shouldIgnoreRotation(character)) { GlyphData uprightData = data.font->uprightOrientationFont()->glyphDataForCharacter(character); // If the glyphs are the same, then we know we can just use the horizontal glyph rotated vertically to be upright. if (data.glyph == uprightData.glyph) return data; // The glyphs are distinct, meaning that the font has a vertical-right glyph baked into it. We can't use that // glyph, so we fall back to the upright data and use the horizontal glyph. if (uprightData.font) return uprightData; } else if (orientation == NonCJKGlyphOrientationVerticalRight) { GlyphData verticalRightData = data.font->verticalRightOrientationFont()->glyphDataForCharacter(character); // If the glyphs are distinct, we will make the assumption that the font has a vertical-right glyph baked // into it. if (data.glyph != verticalRightData.glyph) return data; // The glyphs are identical, meaning that we should just use the horizontal glyph. if (verticalRightData.font) return verticalRightData; } return data; }