Deduplicate axis value resolving code.

The code was originally written for Android, but is now implemented
more generally by the FreeType scanner to be shared between all
FreeType backed typefaces. This removes the now duplicate code in the
Android font manager and uses the shared code instead.

GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1726213004

Review URL: https://codereview.chromium.org/1726213004
diff --git a/src/ports/SkFontMgr_android.cpp b/src/ports/SkFontMgr_android.cpp
index a71e2c9..93a7d86 100644
--- a/src/ports/SkFontMgr_android.cpp
+++ b/src/ports/SkFontMgr_android.cpp
@@ -198,49 +198,9 @@
             }
 
             SkAutoSTMalloc<4, SkFixed> axisValues(axisDefinitions.count());
-            for (int i = 0; i < axisDefinitions.count(); ++i) {
-                const Scanner::AxisDefinition& axisDefinition = axisDefinitions[i];
-                axisValues[i] = axisDefinition.fDefault;
-                for (int j = 0; j < fontFile.fAxes.count(); ++j) {
-                    const FontFileInfo::Axis& axisSpecified = fontFile.fAxes[j];
-                    if (axisDefinition.fTag == axisSpecified.fTag) {
-                        axisValues[i] = SkTPin(axisSpecified.fValue, axisDefinition.fMinimum,
-                                                                     axisDefinition.fMaximum);
-                        if (axisValues[i] != axisSpecified.fValue) {
-                            SkDEBUGF(("Requested font axis value out of range: "
-                                      "%s '%c%c%c%c' %f; pinned to %f.\n",
-                                      familyName.c_str(),
-                                      (axisDefinition.fTag >> 24) & 0xFF,
-                                      (axisDefinition.fTag >> 16) & 0xFF,
-                                      (axisDefinition.fTag >>  8) & 0xFF,
-                                      (axisDefinition.fTag      ) & 0xFF,
-                                      SkFixedToDouble(axisSpecified.fValue),
-                                      SkFixedToDouble(axisValues[i])));
-                        }
-                        break;
-                    }
-                }
-                // TODO: warn on defaulted axis?
-            }
-
-            SkDEBUGCODE(
-                // Check for axis specified, but not matched in font.
-                for (int i = 0; i < fontFile.fAxes.count(); ++i) {
-                    SkFourByteTag skTag = fontFile.fAxes[i].fTag;
-                    bool found = false;
-                    for (int j = 0; j < axisDefinitions.count(); ++j) {
-                        if (skTag == axisDefinitions[j].fTag) {
-                            found = true;
-                            break;
-                        }
-                    }
-                    if (!found) {
-                        SkDEBUGF(("Requested font axis not found: %s '%c%c%c%c'\n",
-                                    familyName.c_str(), (skTag >> 24) & 0xFF,
-                                    (skTag >> 16) & 0xFF, (skTag >> 8) & 0xFF, (skTag)&0xFF));
-                    }
-                }
-            )
+            Scanner::computeAxisValues(axisDefinitions,
+                                       fontFile.fAxes.begin(), fontFile.fAxes.count(),
+                                       axisValues, familyName);
 
             fStyles.push_back().reset(new SkTypeface_AndroidSystem(
                     pathName, cacheFontFiles, ttcIndex, axisValues.get(), axisDefinitions.count(),