aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkFindAndPlaceGlyph.h
diff options
context:
space:
mode:
authorGravatar bungeman <bungeman@google.com>2016-02-29 11:22:55 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-02-29 11:22:55 -0800
commit27876bc1156bcdd15cac7f0fe6228eb7806b8e96 (patch)
treedc5617a6be3255ce9eced721e9c3004dc8f58bcf /src/core/SkFindAndPlaceGlyph.h
parent10d8fc29bc1605c134e98f5b58c2efb73cef6073 (diff)
Improve horizontal baseline detection.
The goal is to hint the baseline when hinting is possible, which is to say when the glyphs are be aligned with the pixel grid. The current code has three shortcomings. 1. correctly snaps when the horizontal baseline is on the x-axis but not when on the y-axis. Instead it is snapping the horizontal baseline when there is y-skew. 2. tests against the full device matrix instead of the relaxed matrix used by the scaler context. 3. has range issues when relaxing the matrix. GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1740163002 Review URL: https://codereview.chromium.org/1740163002
Diffstat (limited to 'src/core/SkFindAndPlaceGlyph.h')
-rw-r--r--src/core/SkFindAndPlaceGlyph.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/core/SkFindAndPlaceGlyph.h b/src/core/SkFindAndPlaceGlyph.h
index 78a02c0e4d..18b93f70a4 100644
--- a/src/core/SkFindAndPlaceGlyph.h
+++ b/src/core/SkFindAndPlaceGlyph.h
@@ -587,9 +587,8 @@ inline void SkFindAndPlaceGlyph::ProcessPosText(
SkPaint::Align textAlignment,
SkGlyphCache* cache, ProcessOneGlyph&& processOneGlyph) {
- SkAxisAlignment axisAlignment = SkComputeAxisAlignmentForHText(matrix);
+ SkAxisAlignment axisAlignment = cache->getScalerContext()->computeAxisAlignmentForHText();
uint32_t mtype = matrix.getType();
-
LookupGlyph glyphFinder(textEncoding, cache);
// Specialized code for handling the most common case for blink. The while loop is totally
@@ -710,7 +709,8 @@ inline void SkFindAndPlaceGlyph::ProcessText(
GlyphFindAndPlace<ProcessOneGlyph> findAndPosition{
[&](typename GlyphFindAndPlace<ProcessOneGlyph>::Variants* to_init) {
if (cache->isSubpixel()) {
- SkAxisAlignment axisAlignment = SkComputeAxisAlignmentForHText(matrix);
+ SkAxisAlignment axisAlignment =
+ cache->getScalerContext()->computeAxisAlignmentForHText();
InitSubpixel<ProcessOneGlyph, SkPaint::kLeft_Align>(
to_init, axisAlignment, glyphFinder);
} else {