Add strikeout font metrics.
This also updates create_test_font so that it can be built, compiles, and uses SkFontStyle instead of SkTypeface::Style. BUG=b/63669723 Change-Id: I6eb0f851853f4721cf8e5052255b5b6750c3257f Reviewed-on: https://skia-review.googlesource.com/24740 Reviewed-by: Cary Clark <caryclark@google.com> Reviewed-by: Mike Reed <reed@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Ben Wagner <bungeman@google.com>
This commit is contained in:
parent
f19421961c
commit
219f3622ba
15
BUILD.gn
15
BUILD.gn
@ -891,12 +891,14 @@ if (skia_enable_tools) {
|
||||
if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
|
||||
shared_library("lib" + target_name) {
|
||||
forward_variables_from(invoker, "*", [ "is_shared_library" ])
|
||||
configs += [ ":skia_private", ]
|
||||
testonly = true
|
||||
}
|
||||
} else {
|
||||
_executable = target_name
|
||||
executable(_executable) {
|
||||
forward_variables_from(invoker, "*", [ "is_shared_library" ])
|
||||
configs += [ ":skia_private", ]
|
||||
testonly = true
|
||||
}
|
||||
}
|
||||
@ -1392,6 +1394,19 @@ if (skia_enable_tools) {
|
||||
]
|
||||
}
|
||||
|
||||
test_app("create_test_font") {
|
||||
sources = [
|
||||
"tools/create_test_font.cpp",
|
||||
]
|
||||
deps = [
|
||||
":skia",
|
||||
]
|
||||
assert_no_deps = [
|
||||
# tool_utils requires the output of this app.
|
||||
":tool_utils",
|
||||
]
|
||||
}
|
||||
|
||||
test_app("get_images_from_skps") {
|
||||
sources = [
|
||||
"tools/get_images_from_skps.cpp",
|
||||
|
@ -230,18 +230,55 @@ public:
|
||||
}
|
||||
|
||||
static void show_bounds(SkCanvas* canvas, const SkPaint& paint, SkScalar x, SkScalar y,
|
||||
SkColor boundsColor) {
|
||||
const char str[] = "jyHO[]{}@-_&%$";
|
||||
SkColor boundsColor)
|
||||
{
|
||||
SkPaint glyphPaint(paint);
|
||||
SkRect fontBounds = glyphPaint.getFontBounds();
|
||||
fontBounds.offset(x, y);
|
||||
SkPaint boundsPaint(glyphPaint);
|
||||
boundsPaint.setColor(boundsColor);
|
||||
canvas->drawRect(fontBounds, boundsPaint);
|
||||
|
||||
for (int i = 0; str[i]; ++i) {
|
||||
canvas->drawText(&str[i], 1, x, y, paint);
|
||||
SkPaint::FontMetrics fm;
|
||||
glyphPaint.getFontMetrics(&fm);
|
||||
SkPaint metricsPaint(boundsPaint);
|
||||
metricsPaint.setStyle(SkPaint::kFill_Style);
|
||||
metricsPaint.setAlpha(0x40);
|
||||
if ((fm.fFlags & SkPaint::FontMetrics::kUnderlinePositionIsValid_Flag) &&
|
||||
(fm.fFlags & SkPaint::FontMetrics::kUnderlinePositionIsValid_Flag))
|
||||
{
|
||||
SkRect underline{ fontBounds.fLeft, fm.fUnderlinePosition+y,
|
||||
fontBounds.fRight, fm.fUnderlinePosition+y + fm.fUnderlineThickness };
|
||||
canvas->drawRect(underline, metricsPaint);
|
||||
}
|
||||
|
||||
SkRect r = paint.getFontBounds();
|
||||
r.offset(x, y);
|
||||
SkPaint p(paint);
|
||||
p.setColor(boundsColor);
|
||||
canvas->drawRect(r, p);
|
||||
if ((fm.fFlags & SkPaint::FontMetrics::kStrikeoutPositionIsValid_Flag) &&
|
||||
(fm.fFlags & SkPaint::FontMetrics::kStrikeoutPositionIsValid_Flag))
|
||||
{
|
||||
SkRect strikeout{ fontBounds.fLeft, fm.fStrikeoutPosition+y - fm.fStrikeoutThickness,
|
||||
fontBounds.fRight, fm.fStrikeoutPosition+y };
|
||||
canvas->drawRect(strikeout, metricsPaint);
|
||||
}
|
||||
|
||||
SkGlyphID left = 0, right = 0, top = 0, bottom = 0;
|
||||
{
|
||||
int numGlyphs = glyphPaint.getTypeface()->countGlyphs();
|
||||
SkRect min = {0, 0, 0, 0};
|
||||
glyphPaint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
|
||||
for (int i = 0; i < numGlyphs; ++i) {
|
||||
SkGlyphID glyphId = i;
|
||||
SkRect cur;
|
||||
glyphPaint.measureText(&glyphId, sizeof(glyphId), &cur);
|
||||
if (cur.fLeft < min.fLeft ) { min.fLeft = cur.fLeft; left = i; }
|
||||
if (cur.fTop < min.fTop ) { min.fTop = cur.fTop ; top = i; }
|
||||
if (min.fRight < cur.fRight ) { min.fRight = cur.fRight; right = i; }
|
||||
if (min.fBottom < cur.fBottom) { min.fBottom = cur.fBottom; bottom = i; }
|
||||
}
|
||||
}
|
||||
SkGlyphID str[] = { left, right, top, bottom };
|
||||
for (size_t i = 0; i < SK_ARRAY_COUNT(str); ++i) {
|
||||
canvas->drawText(&str[i], sizeof(str[0]), x, y, glyphPaint);
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -270,21 +307,23 @@ protected:
|
||||
int index = 0;
|
||||
SkScalar x = 0, y = 0;
|
||||
|
||||
canvas->translate(80, 120);
|
||||
canvas->translate(10, 120);
|
||||
|
||||
for (int i = 0; i < count; ++i) {
|
||||
sk_sp<SkFontStyleSet> set(fm->createStyleSet(i));
|
||||
for (int j = 0; j < set->count(); ++j) {
|
||||
for (int j = 0; j < set->count() && j < 3; ++j) {
|
||||
paint.setTypeface(sk_sp<SkTypeface>(set->createTypeface(j)));
|
||||
if (paint.getTypeface()) {
|
||||
SkRect fontBounds = paint.getFontBounds();
|
||||
x -= fontBounds.fLeft;
|
||||
show_bounds(canvas, paint, x, y, boundsColors[index & 1]);
|
||||
x += fontBounds.fRight + 20;
|
||||
index += 1;
|
||||
x += 160;
|
||||
if (0 == (index % 6)) {
|
||||
if (x > 900) {
|
||||
x = 0;
|
||||
y += 160;
|
||||
}
|
||||
if (index >= 30) {
|
||||
if (y >= 700) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -694,6 +694,8 @@ public:
|
||||
enum FontMetricsFlags {
|
||||
kUnderlineThicknessIsValid_Flag = 1 << 0,
|
||||
kUnderlinePositionIsValid_Flag = 1 << 1,
|
||||
kStrikeoutThicknessIsValid_Flag = 1 << 2,
|
||||
kStrikeoutPositionIsValid_Flag = 1 << 3,
|
||||
};
|
||||
|
||||
uint32_t fFlags; //!< Bit field to identify which values are unknown
|
||||
@ -710,18 +712,21 @@ public:
|
||||
SkScalar fCapHeight; //!< The cap height (> 0), or 0 if cannot be determined.
|
||||
SkScalar fUnderlineThickness; //!< underline thickness, or 0 if cannot be determined
|
||||
|
||||
/** Underline Position - position of the top of the Underline stroke
|
||||
relative to the baseline, this can have following values
|
||||
- Negative - means underline should be drawn above baseline.
|
||||
- Positive - means below baseline.
|
||||
- Zero - mean underline should be drawn on baseline.
|
||||
/** Position of the top of the underline stroke relative to the baseline.
|
||||
* A positive value means draw below the baseline; negative values above.
|
||||
*/
|
||||
SkScalar fUnderlinePosition; //!< underline position, or 0 if cannot be determined
|
||||
SkScalar fUnderlinePosition;
|
||||
|
||||
/** If the fontmetrics has a valid underline thickness, return true, and set the
|
||||
thickness param to that value. If it doesn't return false and ignore the
|
||||
thickness param.
|
||||
*/
|
||||
SkScalar fStrikeoutThickness; //!< strikeout thickness, or 0 if cannot be determined
|
||||
|
||||
/** Position of the bottom of the strikeout stroke relative to the baseline.
|
||||
* A positive value means draw below the baseline; negative values above.
|
||||
*/
|
||||
SkScalar fStrikeoutPosition;
|
||||
|
||||
/** If the underline thickness is valid return true and set thickness.
|
||||
* Otherwise return false and ignore the thickness param.
|
||||
*/
|
||||
bool hasUnderlineThickness(SkScalar* thickness) const {
|
||||
if (SkToBool(fFlags & kUnderlineThicknessIsValid_Flag)) {
|
||||
*thickness = fUnderlineThickness;
|
||||
@ -730,10 +735,9 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
/** If the fontmetrics has a valid underline position, return true, and set the
|
||||
position param to that value. If it doesn't return false and ignore the
|
||||
position param.
|
||||
*/
|
||||
/** If the underline position is valid return true and set position.
|
||||
* Otherwise return false and ignore the position param.
|
||||
*/
|
||||
bool hasUnderlinePosition(SkScalar* position) const {
|
||||
if (SkToBool(fFlags & kUnderlinePositionIsValid_Flag)) {
|
||||
*position = fUnderlinePosition;
|
||||
@ -742,6 +746,27 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
/** If the strikeout thickness is valid return true and set thickness.
|
||||
* Otherwise return false and ignore the thickness param.
|
||||
*/
|
||||
bool hasStrikeoutThickness(SkScalar* thickness) const {
|
||||
if (SkToBool(fFlags & kStrikeoutThicknessIsValid_Flag)) {
|
||||
*thickness = fStrikeoutThickness;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** If the strikeout position is valid return true and set position.
|
||||
* Otherwise return false and ignore the position param.
|
||||
*/
|
||||
bool hasStrikeoutPosition(SkScalar* position) const {
|
||||
if (SkToBool(fFlags & kStrikeoutPositionIsValid_Flag)) {
|
||||
*position = fStrikeoutPosition;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/** Return the recommend spacing between lines (which will be
|
||||
|
@ -25,7 +25,7 @@ struct SkTestFontData {
|
||||
const SkFixed* fWidths;
|
||||
const SkPaint::FontMetrics& fMetrics;
|
||||
const char* fName;
|
||||
SkTypeface::Style fStyle;
|
||||
SkFontStyle fStyle;
|
||||
sk_sp<SkTestFont> fCachedFont;
|
||||
};
|
||||
|
||||
|
@ -1289,6 +1289,7 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* metrics
|
||||
}
|
||||
|
||||
FT_Face face = fFace;
|
||||
metrics->fFlags = 0;
|
||||
|
||||
// fetch units/EM from "head" table if needed (ie for bitmap fonts)
|
||||
SkScalar upem = SkIntToScalar(face->units_per_EM);
|
||||
@ -1303,10 +1304,15 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* metrics
|
||||
SkScalar x_height = 0.0f;
|
||||
SkScalar avgCharWidth = 0.0f;
|
||||
SkScalar cap_height = 0.0f;
|
||||
SkScalar strikeoutThickness, strikeoutPosition;
|
||||
TT_OS2* os2 = (TT_OS2*) FT_Get_Sfnt_Table(face, ft_sfnt_os2);
|
||||
if (os2) {
|
||||
x_height = SkIntToScalar(os2->sxHeight) / upem * fScale.y();
|
||||
avgCharWidth = SkIntToScalar(os2->xAvgCharWidth) / upem;
|
||||
strikeoutThickness = SkIntToScalar(os2->yStrikeoutSize) / upem;
|
||||
strikeoutPosition = -SkIntToScalar(os2->yStrikeoutPosition) / upem;
|
||||
metrics->fFlags |= SkPaint::FontMetrics::kStrikeoutThicknessIsValid_Flag;
|
||||
metrics->fFlags |= SkPaint::FontMetrics::kStrikeoutPositionIsValid_Flag;
|
||||
if (os2->version != 0xFFFF && os2->version >= 2) {
|
||||
cap_height = SkIntToScalar(os2->sCapHeight) / upem * fScale.y();
|
||||
}
|
||||
@ -1398,10 +1404,13 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* metrics
|
||||
metrics->fAvgCharWidth = avgCharWidth * fScale.y();
|
||||
metrics->fXMin = xmin * fScale.y();
|
||||
metrics->fXMax = xmax * fScale.y();
|
||||
metrics->fMaxCharWidth = metrics->fXMax - metrics->fXMin;
|
||||
metrics->fXHeight = x_height;
|
||||
metrics->fCapHeight = cap_height;
|
||||
metrics->fUnderlineThickness = underlineThickness * fScale.y();
|
||||
metrics->fUnderlinePosition = underlinePosition * fScale.y();
|
||||
metrics->fStrikeoutThickness = strikeoutThickness * fScale.y();
|
||||
metrics->fStrikeoutPosition = strikeoutPosition * fScale.y();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1325,6 +1325,7 @@ void SkScalerContext_Mac::generateFontMetrics(SkPaint::FontMetrics* metrics) {
|
||||
metrics->fUnderlineThickness = CGToScalar( CTFontGetUnderlineThickness(fCTFont.get()));
|
||||
metrics->fUnderlinePosition = -CGToScalar( CTFontGetUnderlinePosition(fCTFont.get()));
|
||||
|
||||
metrics->fFlags = 0;
|
||||
metrics->fFlags |= SkPaint::FontMetrics::kUnderlineThicknessIsValid_Flag;
|
||||
metrics->fFlags |= SkPaint::FontMetrics::kUnderlinePositionIsValid_Flag;
|
||||
|
||||
|
@ -612,9 +612,13 @@ void SkScalerContext_DW::generateFontMetrics(SkPaint::FontMetrics* metrics) {
|
||||
metrics->fCapHeight = fTextSizeRender * SkIntToScalar(dwfm.capHeight) / upem;
|
||||
metrics->fUnderlineThickness = fTextSizeRender * SkIntToScalar(dwfm.underlineThickness) / upem;
|
||||
metrics->fUnderlinePosition = -(fTextSizeRender * SkIntToScalar(dwfm.underlinePosition) / upem);
|
||||
metrics->fStrikeoutThickness = fTextSizeRender * SkIntToScalar(dwfm.strikethroughThickness) / upem;
|
||||
metrics->fStrikeoutPosition = -(fTextSizeRender * SkIntToScalar(dwfm.strikethroughPosition) / upem);
|
||||
|
||||
metrics->fFlags |= SkPaint::FontMetrics::kUnderlineThicknessIsValid_Flag;
|
||||
metrics->fFlags |= SkPaint::FontMetrics::kUnderlinePositionIsValid_Flag;
|
||||
metrics->fFlags |= SkPaint::FontMetrics::kStrikeoutThicknessIsValid_Flag;
|
||||
metrics->fFlags |= SkPaint::FontMetrics::kStrikeoutPositionIsValid_Flag;
|
||||
|
||||
if (this->getDWriteTypeface()->fDWriteFontFace1.get()) {
|
||||
DWRITE_FONT_METRICS1 dwfm1;
|
||||
|
@ -5,11 +5,12 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
// running create_test_font generates ./tools/test_font_data.cpp
|
||||
// which is read by ./tools/sk_tool_utils_font.cpp
|
||||
// running create_test_font generates ./tools/test_font_index.inc
|
||||
// and ./tools/test_font_<generic name>.inc which are read by ./tools/sk_tool_utils_font.cpp
|
||||
|
||||
#include "Resources.h"
|
||||
#include "SkOSFile.h"
|
||||
#include "SkOSPath.h"
|
||||
#include "SkPaint.h"
|
||||
#include "SkPath.h"
|
||||
#include "SkStream.h"
|
||||
@ -21,36 +22,40 @@
|
||||
|
||||
#define DEFAULT_FONT_NAME "sans-serif"
|
||||
|
||||
static struct FontDesc {
|
||||
namespace {
|
||||
|
||||
struct NamedFontStyle {
|
||||
const char* fName;
|
||||
SkTypeface::Style fStyle;
|
||||
const char* fFont;
|
||||
SkFontStyle fStyle;
|
||||
};
|
||||
NamedFontStyle normal = {"Normal", SkFontStyle(SkFontStyle::kNormal_Weight, SkFontStyle::kNormal_Width, SkFontStyle::kUpright_Slant)};
|
||||
NamedFontStyle bold = {"Bold", SkFontStyle(SkFontStyle::kBold_Weight, SkFontStyle::kNormal_Width, SkFontStyle::kUpright_Slant)};
|
||||
NamedFontStyle italic = {"Italic", SkFontStyle(SkFontStyle::kNormal_Weight, SkFontStyle::kNormal_Width, SkFontStyle::kItalic_Slant )};
|
||||
NamedFontStyle bolditalic = {"BoldItalic", SkFontStyle(SkFontStyle::kBold_Weight, SkFontStyle::kNormal_Width, SkFontStyle::kItalic_Slant )};
|
||||
|
||||
struct FontDesc {
|
||||
const char* fGenericName;
|
||||
NamedFontStyle fNamedStyle;
|
||||
const char* fFontName;
|
||||
const char* fFile;
|
||||
int fFontIndex;
|
||||
} gFonts[] = {
|
||||
{"monospace", SkTypeface::kNormal, "Liberation Mono", "LiberationMono-Regular.ttf", -1},
|
||||
{"monospace", SkTypeface::kBold, "Liberation Mono", "LiberationMono-Bold.ttf", -1},
|
||||
{"monospace", SkTypeface::kItalic, "Liberation Mono", "LiberationMono-Italic.ttf", -1},
|
||||
{"monospace", SkTypeface::kBoldItalic, "Liberation Mono", "LiberationMono-BoldItalic.ttf", -1},
|
||||
{"sans-serif", SkTypeface::kNormal, "Liberation Sans", "LiberationSans-Regular.ttf", -1},
|
||||
{"sans-serif", SkTypeface::kBold, "Liberation Sans", "LiberationSans-Bold.ttf", -1},
|
||||
{"sans-serif", SkTypeface::kItalic, "Liberation Sans", "LiberationSans-Italic.ttf", -1},
|
||||
{"sans-serif", SkTypeface::kBoldItalic, "Liberation Sans", "LiberationSans-BoldItalic.ttf", -1},
|
||||
{"serif", SkTypeface::kNormal, "Liberation Serif", "LiberationSerif-Regular.ttf", -1},
|
||||
{"serif", SkTypeface::kBold, "Liberation Serif", "LiberationSerif-Bold.ttf", -1},
|
||||
{"serif", SkTypeface::kItalic, "Liberation Serif", "LiberationSerif-Italic.ttf", -1},
|
||||
{"serif", SkTypeface::kBoldItalic, "Liberation Serif", "LiberationSerif-BoldItalic.ttf", -1},
|
||||
{"monospace", normal, "Liberation Mono", "LiberationMono-Regular.ttf", -1},
|
||||
{"monospace", bold, "Liberation Mono", "LiberationMono-Bold.ttf", -1},
|
||||
{"monospace", italic, "Liberation Mono", "LiberationMono-Italic.ttf", -1},
|
||||
{"monospace", bolditalic, "Liberation Mono", "LiberationMono-BoldItalic.ttf", -1},
|
||||
{"sans-serif", normal, "Liberation Sans", "LiberationSans-Regular.ttf", -1},
|
||||
{"sans-serif", bold, "Liberation Sans", "LiberationSans-Bold.ttf", -1},
|
||||
{"sans-serif", italic, "Liberation Sans", "LiberationSans-Italic.ttf", -1},
|
||||
{"sans-serif", bolditalic, "Liberation Sans", "LiberationSans-BoldItalic.ttf", -1},
|
||||
{"serif", normal, "Liberation Serif", "LiberationSerif-Regular.ttf", -1},
|
||||
{"serif", bold, "Liberation Serif", "LiberationSerif-Bold.ttf", -1},
|
||||
{"serif", italic, "Liberation Serif", "LiberationSerif-Italic.ttf", -1},
|
||||
{"serif", bolditalic, "Liberation Serif", "LiberationSerif-BoldItalic.ttf", -1},
|
||||
};
|
||||
|
||||
const int gFontsCount = (int) SK_ARRAY_COUNT(gFonts);
|
||||
|
||||
const char* gStyleName[] = {
|
||||
"Normal",
|
||||
"Bold",
|
||||
"Italic",
|
||||
"BoldItalic",
|
||||
};
|
||||
|
||||
const char gHeader[] =
|
||||
"/*\n"
|
||||
" * Copyright 2015 Google Inc.\n"
|
||||
@ -61,6 +66,8 @@ const char gHeader[] =
|
||||
"\n"
|
||||
"// Auto-generated by ";
|
||||
|
||||
} // namespace
|
||||
|
||||
static FILE* font_header(const char* family) {
|
||||
SkString outPath(SkOSPath::Join(".", "tools"));
|
||||
outPath = SkOSPath::Join(outPath.c_str(), "test_font_");
|
||||
@ -73,7 +80,7 @@ static FILE* font_header(const char* family) {
|
||||
fam.writable_str()[dashIndex] = '_';
|
||||
} while (true);
|
||||
outPath.append(fam);
|
||||
outPath.append(".cpp");
|
||||
outPath.append(".inc");
|
||||
FILE* out = fopen(outPath.c_str(), "w");
|
||||
fprintf(out, "%s%s\n\n", gHeader, SkOSPath::Basename(__FILE__).c_str());
|
||||
return out;
|
||||
@ -214,14 +221,14 @@ static SkString strip_final(const SkString& str) {
|
||||
return result;
|
||||
}
|
||||
|
||||
static void output_font(SkTypeface* face, const char* name, SkTypeface::Style style, FILE* out) {
|
||||
static void output_font(sk_sp<SkTypeface> face, const char* name, NamedFontStyle style, FILE* out) {
|
||||
int emSize = face->getUnitsPerEm() * 2;
|
||||
SkPaint paint;
|
||||
paint.setAntiAlias(true);
|
||||
paint.setTextAlign(SkPaint::kLeft_Align);
|
||||
paint.setTextEncoding(SkPaint::kUTF16_TextEncoding);
|
||||
paint.setTextSize(emSize);
|
||||
SkSafeUnref(paint.setTypeface(face));
|
||||
paint.setTypeface(std::move(face));
|
||||
SkTDArray<SkPath::Verb> verbs;
|
||||
SkTDArray<unsigned> charCodes;
|
||||
SkTDArray<SkScalar> widths;
|
||||
@ -229,7 +236,7 @@ static void output_font(SkTypeface* face, const char* name, SkTypeface::Style st
|
||||
output_path_data(paint, emSize, &ptsOut, &verbs, &charCodes, &widths);
|
||||
SkString fontnameStr(name);
|
||||
SkString strippedStr = strip_spaces(fontnameStr);
|
||||
strippedStr.appendf("%s", gStyleName[style]);
|
||||
strippedStr.appendf("%s", style.fName);
|
||||
const char* fontname = strippedStr.c_str();
|
||||
fprintf(out, "const SkScalar %sPoints[] = {\n", fontname);
|
||||
ptsOut = strip_final(ptsOut);
|
||||
@ -305,13 +312,15 @@ static void output_font(SkTypeface* face, const char* name, SkTypeface::Style st
|
||||
output_scalar(metrics.fCapHeight, emSize, &metricsStr);
|
||||
output_scalar(metrics.fUnderlineThickness, emSize, &metricsStr);
|
||||
output_scalar(metrics.fUnderlinePosition, emSize, &metricsStr);
|
||||
output_scalar(metrics.fStrikeoutThickness, emSize, &metricsStr);
|
||||
output_scalar(metrics.fStrikeoutPosition, emSize, &metricsStr);
|
||||
metricsStr = strip_final(metricsStr);
|
||||
fprintf(out, "%s\n};\n\n", metricsStr.c_str());
|
||||
}
|
||||
|
||||
struct FontWritten {
|
||||
const char* fName;
|
||||
SkTypeface::Style fStyle;
|
||||
const char* fFontName;
|
||||
NamedFontStyle fNamedStyle;
|
||||
};
|
||||
|
||||
static SkTDArray<FontWritten> gWritten;
|
||||
@ -319,88 +328,74 @@ static SkTDArray<FontWritten> gWritten;
|
||||
static int written_index(const FontDesc& fontDesc) {
|
||||
for (int index = 0; index < gWritten.count(); ++index) {
|
||||
const FontWritten& writ = gWritten[index];
|
||||
if (!strcmp(fontDesc.fFont, writ.fName) && fontDesc.fStyle == writ.fStyle) {
|
||||
if (!strcmp(fontDesc.fFontName, writ.fFontName) &&
|
||||
fontDesc.fNamedStyle.fStyle == writ.fNamedStyle.fStyle)
|
||||
{
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void generate_fonts() {
|
||||
static void generate_fonts(const char* basepath) {
|
||||
FILE* out = nullptr;
|
||||
for (int index = 0; index < gFontsCount; ++index) {
|
||||
FontDesc& fontDesc = gFonts[index];
|
||||
if ((index & 3) == 0) {
|
||||
out = font_header(fontDesc.fName);
|
||||
out = font_header(fontDesc.fGenericName);
|
||||
}
|
||||
int fontIndex = written_index(fontDesc);
|
||||
if (fontIndex >= 0) {
|
||||
fontDesc.fFontIndex = fontIndex;
|
||||
continue;
|
||||
}
|
||||
SkTypeface* systemTypeface = SkTypeface::CreateFromName(fontDesc.fFont, fontDesc.fStyle);
|
||||
SkASSERT(systemTypeface);
|
||||
SkString filepath("/Library/Fonts/");
|
||||
filepath.append(fontDesc.fFile);
|
||||
SkASSERT(sk_exists(filepath.c_str()));
|
||||
SkTypeface* resourceTypeface = SkTypeface::CreateFromFile(filepath.c_str());
|
||||
SkASSERT(resourceTypeface);
|
||||
output_font(resourceTypeface, fontDesc.fFont, fontDesc.fStyle, out);
|
||||
SkString filepath(SkOSPath::Join(basepath, fontDesc.fFile));
|
||||
SkASSERTF(sk_exists(filepath.c_str()), "The file %s does not exist.", filepath.c_str());
|
||||
sk_sp<SkTypeface> resourceTypeface = SkTypeface::MakeFromFile(filepath.c_str());
|
||||
SkASSERTF(resourceTypeface, "The file %s is not a font.", filepath.c_str());
|
||||
output_font(std::move(resourceTypeface), fontDesc.fFontName, fontDesc.fNamedStyle, out);
|
||||
fontDesc.fFontIndex = gWritten.count();
|
||||
FontWritten* writ = gWritten.append();
|
||||
writ->fName = fontDesc.fFont;
|
||||
writ->fStyle = fontDesc.fStyle;
|
||||
writ->fFontName = fontDesc.fFontName;
|
||||
writ->fNamedStyle = fontDesc.fNamedStyle;
|
||||
if ((index & 3) == 3) {
|
||||
fclose(out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void generate_index(const char* defaultName) {
|
||||
int fontCount = gWritten.count();
|
||||
FILE* out = font_header("index");
|
||||
int fontIndex;
|
||||
#if 0
|
||||
// currently generated files are inlined one after the other.
|
||||
// if the inlining is undesirable, generate externs using the code below
|
||||
// (additional code required to add include files)
|
||||
for (fontIndex = 0; fontIndex < fontCount; ++fontIndex) {
|
||||
const FontWritten& writ = gWritten[fontIndex];
|
||||
const char* name = writ.fName;
|
||||
SkString strippedStr = strip_spaces(SkString(name));
|
||||
strippedStr.appendf("%s", gStyleName[writ.fStyle]);
|
||||
const char* strip = strippedStr.c_str();
|
||||
fprintf(out,
|
||||
"extern const SkScalar %sPoints[];\n"
|
||||
"extern const unsigned char %sVerbs[];\n"
|
||||
"extern const unsigned %sCharCodes[];\n"
|
||||
"extern const int %sCharCodesCount;\n"
|
||||
"extern const SkFixed %sWidths[];\n"
|
||||
"extern const SkPaint::FontMetrics %sMetrics;\n",
|
||||
strip, strip, strip, strip, strip, strip);
|
||||
static const char* slant_to_string(SkFontStyle::Slant slant) {
|
||||
switch (slant) {
|
||||
case SkFontStyle::kUpright_Slant: return "SkFontStyle::kUpright_Slant";
|
||||
case SkFontStyle::kItalic_Slant : return "SkFontStyle::kItalic_Slant" ;
|
||||
case SkFontStyle::kOblique_Slant: return "SkFontStyle::kOblique_Slant";
|
||||
default: SK_ABORT("Unknown slant"); return "";
|
||||
}
|
||||
fprintf(out, "\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
static void generate_index(const char* defaultName) {
|
||||
FILE* out = font_header("index");
|
||||
fprintf(out, "static SkTestFontData gTestFonts[] = {\n");
|
||||
for (fontIndex = 0; fontIndex < fontCount; ++fontIndex) {
|
||||
const FontWritten& writ = gWritten[fontIndex];
|
||||
const char* name = writ.fName;
|
||||
for (const FontWritten& writ : gWritten) {
|
||||
const char* name = writ.fFontName;
|
||||
SkString strippedStr = strip_spaces(SkString(name));
|
||||
strippedStr.appendf("%s", gStyleName[writ.fStyle]);
|
||||
strippedStr.appendf("%s", writ.fNamedStyle.fName);
|
||||
const char* strip = strippedStr.c_str();
|
||||
fprintf(out,
|
||||
" { %sPoints, %sVerbs, %sCharCodes,\n"
|
||||
" %sCharCodesCount, %sWidths,\n"
|
||||
" %sMetrics, \"Toy %s\", SkTypeface::k%s, nullptr\n"
|
||||
" %sMetrics, \"Toy %s\", SkFontStyle(%d,%d,%s), nullptr\n"
|
||||
" },\n",
|
||||
strip, strip, strip, strip, strip, strip, name, gStyleName[writ.fStyle]);
|
||||
strip, strip, strip, strip, strip, strip, name,
|
||||
writ.fNamedStyle.fStyle.weight(), writ.fNamedStyle.fStyle.width(),
|
||||
slant_to_string(writ.fNamedStyle.fStyle.slant()));
|
||||
}
|
||||
fprintf(out, "};\n\n");
|
||||
fprintf(out, "const int gTestFontsCount = (int) SK_ARRAY_COUNT(gTestFonts);\n\n");
|
||||
fprintf(out,
|
||||
"struct SubFont {\n"
|
||||
" const char* fName;\n"
|
||||
" SkTypeface::Style fStyle;\n"
|
||||
" SkFontStyle fStyle;\n"
|
||||
" SkTestFontData& fFont;\n"
|
||||
" const char* fFile;\n"
|
||||
"};\n\n"
|
||||
@ -408,18 +403,22 @@ static void generate_index(const char* defaultName) {
|
||||
int defaultIndex = -1;
|
||||
for (int subIndex = 0; subIndex < gFontsCount; subIndex++) {
|
||||
const FontDesc& desc = gFonts[subIndex];
|
||||
if (defaultIndex < 0 && !strcmp(defaultName, desc.fName)) {
|
||||
if (defaultIndex < 0 && !strcmp(defaultName, desc.fGenericName)) {
|
||||
defaultIndex = subIndex;
|
||||
}
|
||||
fprintf(out,
|
||||
" { \"%s\", SkTypeface::k%s, gTestFonts[%d], \"%s\" },\n", desc.fName,
|
||||
gStyleName[desc.fStyle], desc.fFontIndex, desc.fFile);
|
||||
" { \"%s\", SkFontStyle(%d,%d,%s), gTestFonts[%d], \"%s\" },\n",
|
||||
desc.fGenericName,
|
||||
desc.fNamedStyle.fStyle.weight(), desc.fNamedStyle.fStyle.width(),
|
||||
slant_to_string(desc.fNamedStyle.fStyle.slant()), desc.fFontIndex, desc.fFile);
|
||||
}
|
||||
for (int subIndex = 0; subIndex < gFontsCount; subIndex++) {
|
||||
const FontDesc& desc = gFonts[subIndex];
|
||||
fprintf(out,
|
||||
" { \"Toy %s\", SkTypeface::k%s, gTestFonts[%d], \"%s\" },\n", desc.fFont,
|
||||
gStyleName[desc.fStyle], desc.fFontIndex, desc.fFile);
|
||||
" { \"Toy %s\", SkFontStyle(%d,%d,%s), gTestFonts[%d], \"%s\" },\n",
|
||||
desc.fFontName,
|
||||
desc.fNamedStyle.fStyle.weight(), desc.fNamedStyle.fStyle.width(),
|
||||
slant_to_string(desc.fNamedStyle.fStyle.slant()), desc.fFontIndex, desc.fFile);
|
||||
}
|
||||
fprintf(out, "};\n\n");
|
||||
fprintf(out, "const int gSubFontsCount = (int) SK_ARRAY_COUNT(gSubFonts);\n\n");
|
||||
@ -429,10 +428,7 @@ static void generate_index(const char* defaultName) {
|
||||
}
|
||||
|
||||
int main(int , char * const []) {
|
||||
#ifndef SK_BUILD_FOR_MAC
|
||||
#error "use fonts installed on Mac"
|
||||
#endif
|
||||
generate_fonts();
|
||||
generate_fonts("/Library/Fonts/");
|
||||
generate_index(DEFAULT_FONT_NAME);
|
||||
return 0;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
// Auto-generated by sk_tool_utils_font.cpp
|
||||
|
||||
const char gCourierNew[] =
|
||||
" !/<>ACHMTWYabcdefgilmnoprstuy";
|
||||
const char gCourierNew_Bold[] =
|
||||
" AHTWYabefgmnoprsuy";
|
||||
const char gCourierNew_Italic[] =
|
||||
" AHTWYabefgmnoprsuy";
|
||||
const char gCourierNew_BoldItalic[] =
|
||||
" AHTWYabefgmnoprsuy";
|
||||
const char gLiberationSans[] =
|
||||
" !#%&')*+-./1245679:;<=>?@ABCDEFHIJKLMNOPQRSTVWXYZ[\\]^`abcdefgilmnopqrstuvwxyz";
|
||||
const char gLiberationSans_Bold[] =
|
||||
" !\"#$%&'()*+-./012356789:;=>?ABCDEFGHIJLMORSTUVWXYZ[]^_abdefghijklmnopqrsuvwxyz";
|
||||
const char gLiberationSans_Italic[] =
|
||||
" AHTWYabefgmnoprsuy";
|
||||
const char gLiberationSans_BoldItalic[] =
|
||||
" !,-./012345689:ABCDEFGHIKLMNOPQRSTUWXYZ[\\]_abcdefghijklmnopqrstuvwxyz";
|
||||
const char gHiraginoMaruGothicPro[] =
|
||||
" !Tacefnprsuy" "\xE3" "\x83" "\xBC";
|
||||
const char gPapyrus[] =
|
||||
" !HTaceflnoprsuy";
|
||||
const char gTimesNewRoman[] =
|
||||
" !\"#$%&'()*+,-./123456789;<=>?@ABCDEFGHIJKLMNPQRSTVWXYZ[\\]^_`abcdefgijklmnopqrstuvwxyz";
|
||||
const char gTimesNewRoman_Bold[] =
|
||||
" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz";
|
||||
const char gTimesNewRoman_Italic[] =
|
||||
" AHTWYabefgmnoprsuy";
|
||||
const char gTimesNewRoman_BoldItalic[] =
|
||||
" AHTWYabefgmnoprsuy";
|
@ -10,51 +10,51 @@
|
||||
static SkTestFontData gTestFonts[] = {
|
||||
{ LiberationMonoNormalPoints, LiberationMonoNormalVerbs, LiberationMonoNormalCharCodes,
|
||||
LiberationMonoNormalCharCodesCount, LiberationMonoNormalWidths,
|
||||
LiberationMonoNormalMetrics, "Toy Liberation Mono", SkTypeface::kNormal, nullptr
|
||||
LiberationMonoNormalMetrics, "Toy Liberation Mono", SkFontStyle(400,5,SkFontStyle::kUpright_Slant), nullptr
|
||||
},
|
||||
{ LiberationMonoBoldPoints, LiberationMonoBoldVerbs, LiberationMonoBoldCharCodes,
|
||||
LiberationMonoBoldCharCodesCount, LiberationMonoBoldWidths,
|
||||
LiberationMonoBoldMetrics, "Toy Liberation Mono", SkTypeface::kBold, nullptr
|
||||
LiberationMonoBoldMetrics, "Toy Liberation Mono", SkFontStyle(700,5,SkFontStyle::kUpright_Slant), nullptr
|
||||
},
|
||||
{ LiberationMonoItalicPoints, LiberationMonoItalicVerbs, LiberationMonoItalicCharCodes,
|
||||
LiberationMonoItalicCharCodesCount, LiberationMonoItalicWidths,
|
||||
LiberationMonoItalicMetrics, "Toy Liberation Mono", SkTypeface::kItalic, nullptr
|
||||
LiberationMonoItalicMetrics, "Toy Liberation Mono", SkFontStyle(400,5,SkFontStyle::kItalic_Slant), nullptr
|
||||
},
|
||||
{ LiberationMonoBoldItalicPoints, LiberationMonoBoldItalicVerbs, LiberationMonoBoldItalicCharCodes,
|
||||
LiberationMonoBoldItalicCharCodesCount, LiberationMonoBoldItalicWidths,
|
||||
LiberationMonoBoldItalicMetrics, "Toy Liberation Mono", SkTypeface::kBoldItalic, nullptr
|
||||
LiberationMonoBoldItalicMetrics, "Toy Liberation Mono", SkFontStyle(700,5,SkFontStyle::kItalic_Slant), nullptr
|
||||
},
|
||||
{ LiberationSansNormalPoints, LiberationSansNormalVerbs, LiberationSansNormalCharCodes,
|
||||
LiberationSansNormalCharCodesCount, LiberationSansNormalWidths,
|
||||
LiberationSansNormalMetrics, "Toy Liberation Sans", SkTypeface::kNormal, nullptr
|
||||
LiberationSansNormalMetrics, "Toy Liberation Sans", SkFontStyle(400,5,SkFontStyle::kUpright_Slant), nullptr
|
||||
},
|
||||
{ LiberationSansBoldPoints, LiberationSansBoldVerbs, LiberationSansBoldCharCodes,
|
||||
LiberationSansBoldCharCodesCount, LiberationSansBoldWidths,
|
||||
LiberationSansBoldMetrics, "Toy Liberation Sans", SkTypeface::kBold, nullptr
|
||||
LiberationSansBoldMetrics, "Toy Liberation Sans", SkFontStyle(700,5,SkFontStyle::kUpright_Slant), nullptr
|
||||
},
|
||||
{ LiberationSansItalicPoints, LiberationSansItalicVerbs, LiberationSansItalicCharCodes,
|
||||
LiberationSansItalicCharCodesCount, LiberationSansItalicWidths,
|
||||
LiberationSansItalicMetrics, "Toy Liberation Sans", SkTypeface::kItalic, nullptr
|
||||
LiberationSansItalicMetrics, "Toy Liberation Sans", SkFontStyle(400,5,SkFontStyle::kItalic_Slant), nullptr
|
||||
},
|
||||
{ LiberationSansBoldItalicPoints, LiberationSansBoldItalicVerbs, LiberationSansBoldItalicCharCodes,
|
||||
LiberationSansBoldItalicCharCodesCount, LiberationSansBoldItalicWidths,
|
||||
LiberationSansBoldItalicMetrics, "Toy Liberation Sans", SkTypeface::kBoldItalic, nullptr
|
||||
LiberationSansBoldItalicMetrics, "Toy Liberation Sans", SkFontStyle(700,5,SkFontStyle::kItalic_Slant), nullptr
|
||||
},
|
||||
{ LiberationSerifNormalPoints, LiberationSerifNormalVerbs, LiberationSerifNormalCharCodes,
|
||||
LiberationSerifNormalCharCodesCount, LiberationSerifNormalWidths,
|
||||
LiberationSerifNormalMetrics, "Toy Liberation Serif", SkTypeface::kNormal, nullptr
|
||||
LiberationSerifNormalMetrics, "Toy Liberation Serif", SkFontStyle(400,5,SkFontStyle::kUpright_Slant), nullptr
|
||||
},
|
||||
{ LiberationSerifBoldPoints, LiberationSerifBoldVerbs, LiberationSerifBoldCharCodes,
|
||||
LiberationSerifBoldCharCodesCount, LiberationSerifBoldWidths,
|
||||
LiberationSerifBoldMetrics, "Toy Liberation Serif", SkTypeface::kBold, nullptr
|
||||
LiberationSerifBoldMetrics, "Toy Liberation Serif", SkFontStyle(700,5,SkFontStyle::kUpright_Slant), nullptr
|
||||
},
|
||||
{ LiberationSerifItalicPoints, LiberationSerifItalicVerbs, LiberationSerifItalicCharCodes,
|
||||
LiberationSerifItalicCharCodesCount, LiberationSerifItalicWidths,
|
||||
LiberationSerifItalicMetrics, "Toy Liberation Serif", SkTypeface::kItalic, nullptr
|
||||
LiberationSerifItalicMetrics, "Toy Liberation Serif", SkFontStyle(400,5,SkFontStyle::kItalic_Slant), nullptr
|
||||
},
|
||||
{ LiberationSerifBoldItalicPoints, LiberationSerifBoldItalicVerbs, LiberationSerifBoldItalicCharCodes,
|
||||
LiberationSerifBoldItalicCharCodesCount, LiberationSerifBoldItalicWidths,
|
||||
LiberationSerifBoldItalicMetrics, "Toy Liberation Serif", SkTypeface::kBoldItalic, nullptr
|
||||
LiberationSerifBoldItalicMetrics, "Toy Liberation Serif", SkFontStyle(700,5,SkFontStyle::kItalic_Slant), nullptr
|
||||
},
|
||||
};
|
||||
|
||||
@ -68,30 +68,30 @@ struct SubFont {
|
||||
};
|
||||
|
||||
const SubFont gSubFonts[] = {
|
||||
{ "monospace", SkFontStyle(), gTestFonts[0], "LiberationMono-Regular.ttf" },
|
||||
{ "monospace", SkFontStyle::FromOldStyle(SkTypeface::kBold), gTestFonts[1], "LiberationMono-Bold.ttf" },
|
||||
{ "monospace", SkFontStyle::FromOldStyle(SkTypeface::kItalic), gTestFonts[2], "LiberationMono-Italic.ttf" },
|
||||
{ "monospace", SkFontStyle::FromOldStyle(SkTypeface::kBoldItalic), gTestFonts[3], "LiberationMono-BoldItalic.ttf" },
|
||||
{ "sans-serif", SkFontStyle(), gTestFonts[4], "LiberationSans-Regular.ttf" },
|
||||
{ "sans-serif", SkFontStyle::FromOldStyle(SkTypeface::kBold), gTestFonts[5], "LiberationSans-Bold.ttf" },
|
||||
{ "sans-serif", SkFontStyle::FromOldStyle(SkTypeface::kItalic), gTestFonts[6], "LiberationSans-Italic.ttf" },
|
||||
{ "sans-serif", SkFontStyle::FromOldStyle(SkTypeface::kBoldItalic), gTestFonts[7], "LiberationSans-BoldItalic.ttf" },
|
||||
{ "serif", SkFontStyle(), gTestFonts[8], "LiberationSerif-Regular.ttf" },
|
||||
{ "serif", SkFontStyle::FromOldStyle(SkTypeface::kBold), gTestFonts[9], "LiberationSerif-Bold.ttf" },
|
||||
{ "serif", SkFontStyle::FromOldStyle(SkTypeface::kItalic), gTestFonts[10], "LiberationSerif-Italic.ttf" },
|
||||
{ "serif", SkFontStyle::FromOldStyle(SkTypeface::kBoldItalic), gTestFonts[11], "LiberationSerif-BoldItalic.ttf" },
|
||||
{ "Toy Liberation Mono", SkFontStyle(), gTestFonts[0], "LiberationMono-Regular.ttf" },
|
||||
{ "Toy Liberation Mono", SkFontStyle::FromOldStyle(SkTypeface::kBold), gTestFonts[1], "LiberationMono-Bold.ttf" },
|
||||
{ "Toy Liberation Mono", SkFontStyle::FromOldStyle(SkTypeface::kItalic), gTestFonts[2], "LiberationMono-Italic.ttf" },
|
||||
{ "Toy Liberation Mono", SkFontStyle::FromOldStyle(SkTypeface::kBoldItalic), gTestFonts[3], "LiberationMono-BoldItalic.ttf" },
|
||||
{ "Toy Liberation Sans", SkFontStyle(), gTestFonts[4], "LiberationSans-Regular.ttf" },
|
||||
{ "Toy Liberation Sans", SkFontStyle::FromOldStyle(SkTypeface::kBold), gTestFonts[5], "LiberationSans-Bold.ttf" },
|
||||
{ "Toy Liberation Sans", SkFontStyle::FromOldStyle(SkTypeface::kItalic), gTestFonts[6], "LiberationSans-Italic.ttf" },
|
||||
{ "Toy Liberation Sans", SkFontStyle::FromOldStyle(SkTypeface::kBoldItalic), gTestFonts[7], "LiberationSans-BoldItalic.ttf" },
|
||||
{ "Toy Liberation Serif", SkFontStyle(), gTestFonts[8], "LiberationSerif-Regular.ttf" },
|
||||
{ "Toy Liberation Serif", SkFontStyle::FromOldStyle(SkTypeface::kBold), gTestFonts[9], "LiberationSerif-Bold.ttf" },
|
||||
{ "Toy Liberation Serif", SkFontStyle::FromOldStyle(SkTypeface::kItalic), gTestFonts[10], "LiberationSerif-Italic.ttf" },
|
||||
{ "Toy Liberation Serif", SkFontStyle::FromOldStyle(SkTypeface::kBoldItalic), gTestFonts[11], "LiberationSerif-BoldItalic.ttf" },
|
||||
{ "monospace", SkFontStyle(400,5,SkFontStyle::kUpright_Slant), gTestFonts[0], "LiberationMono-Regular.ttf" },
|
||||
{ "monospace", SkFontStyle(700,5,SkFontStyle::kUpright_Slant), gTestFonts[1], "LiberationMono-Bold.ttf" },
|
||||
{ "monospace", SkFontStyle(400,5,SkFontStyle::kItalic_Slant), gTestFonts[2], "LiberationMono-Italic.ttf" },
|
||||
{ "monospace", SkFontStyle(700,5,SkFontStyle::kItalic_Slant), gTestFonts[3], "LiberationMono-BoldItalic.ttf" },
|
||||
{ "sans-serif", SkFontStyle(400,5,SkFontStyle::kUpright_Slant), gTestFonts[4], "LiberationSans-Regular.ttf" },
|
||||
{ "sans-serif", SkFontStyle(700,5,SkFontStyle::kUpright_Slant), gTestFonts[5], "LiberationSans-Bold.ttf" },
|
||||
{ "sans-serif", SkFontStyle(400,5,SkFontStyle::kItalic_Slant), gTestFonts[6], "LiberationSans-Italic.ttf" },
|
||||
{ "sans-serif", SkFontStyle(700,5,SkFontStyle::kItalic_Slant), gTestFonts[7], "LiberationSans-BoldItalic.ttf" },
|
||||
{ "serif", SkFontStyle(400,5,SkFontStyle::kUpright_Slant), gTestFonts[8], "LiberationSerif-Regular.ttf" },
|
||||
{ "serif", SkFontStyle(700,5,SkFontStyle::kUpright_Slant), gTestFonts[9], "LiberationSerif-Bold.ttf" },
|
||||
{ "serif", SkFontStyle(400,5,SkFontStyle::kItalic_Slant), gTestFonts[10], "LiberationSerif-Italic.ttf" },
|
||||
{ "serif", SkFontStyle(700,5,SkFontStyle::kItalic_Slant), gTestFonts[11], "LiberationSerif-BoldItalic.ttf" },
|
||||
{ "Toy Liberation Mono", SkFontStyle(400,5,SkFontStyle::kUpright_Slant), gTestFonts[0], "LiberationMono-Regular.ttf" },
|
||||
{ "Toy Liberation Mono", SkFontStyle(700,5,SkFontStyle::kUpright_Slant), gTestFonts[1], "LiberationMono-Bold.ttf" },
|
||||
{ "Toy Liberation Mono", SkFontStyle(400,5,SkFontStyle::kItalic_Slant), gTestFonts[2], "LiberationMono-Italic.ttf" },
|
||||
{ "Toy Liberation Mono", SkFontStyle(700,5,SkFontStyle::kItalic_Slant), gTestFonts[3], "LiberationMono-BoldItalic.ttf" },
|
||||
{ "Toy Liberation Sans", SkFontStyle(400,5,SkFontStyle::kUpright_Slant), gTestFonts[4], "LiberationSans-Regular.ttf" },
|
||||
{ "Toy Liberation Sans", SkFontStyle(700,5,SkFontStyle::kUpright_Slant), gTestFonts[5], "LiberationSans-Bold.ttf" },
|
||||
{ "Toy Liberation Sans", SkFontStyle(400,5,SkFontStyle::kItalic_Slant), gTestFonts[6], "LiberationSans-Italic.ttf" },
|
||||
{ "Toy Liberation Sans", SkFontStyle(700,5,SkFontStyle::kItalic_Slant), gTestFonts[7], "LiberationSans-BoldItalic.ttf" },
|
||||
{ "Toy Liberation Serif", SkFontStyle(400,5,SkFontStyle::kUpright_Slant), gTestFonts[8], "LiberationSerif-Regular.ttf" },
|
||||
{ "Toy Liberation Serif", SkFontStyle(700,5,SkFontStyle::kUpright_Slant), gTestFonts[9], "LiberationSerif-Bold.ttf" },
|
||||
{ "Toy Liberation Serif", SkFontStyle(400,5,SkFontStyle::kItalic_Slant), gTestFonts[10], "LiberationSerif-Italic.ttf" },
|
||||
{ "Toy Liberation Serif", SkFontStyle(700,5,SkFontStyle::kItalic_Slant), gTestFonts[11], "LiberationSerif-BoldItalic.ttf" },
|
||||
};
|
||||
|
||||
const int gSubFontsCount = (int) SK_ARRAY_COUNT(gSubFonts);
|
||||
|
@ -1193,8 +1193,9 @@ const SkFixed LiberationMonoNormalWidths[] = {
|
||||
const int LiberationMonoNormalCharCodesCount = (int) SK_ARRAY_COUNT(LiberationMonoNormalCharCodes);
|
||||
|
||||
const SkPaint::FontMetrics LiberationMonoNormalMetrics = {
|
||||
0x30307833, -0.83252f, -0.83252f, 0.300293f, 0.300293f, 0, 0.633301f, 0.00989532f,
|
||||
-0.0244141f, 0.608887f, 0.538086f, 0.0104446f, 0.0410156f, 0.23291f
|
||||
0x0000000f, -0.83252f, -0.83252f, 0.300293f, 0.300293f, 0, 0.600098f, 0.00989532f,
|
||||
-0.0244141f, 0.608887f, 0.52832f, 0.0102921f, 0.0410156f, 0.23291f, 0.000778198f,
|
||||
-0.00404358f
|
||||
};
|
||||
|
||||
const SkScalar LiberationMonoBoldPoints[] = {
|
||||
@ -2343,8 +2344,9 @@ const SkFixed LiberationMonoBoldWidths[] = {
|
||||
const int LiberationMonoBoldCharCodesCount = (int) SK_ARRAY_COUNT(LiberationMonoBoldCharCodes);
|
||||
|
||||
const SkPaint::FontMetrics LiberationMonoBoldMetrics = {
|
||||
0x30307833, -0.83252f, -0.83252f, 0.300293f, 0.300293f, 0, 0.641602f, 0.010025f, -0.0268555f,
|
||||
0.614746f, 0.538086f, 0.0104446f, 0.100098f, 0.23291f
|
||||
0x0000000f, -0.833496f, -0.833496f, 0.300293f, 0.300293f, 0, 0.600098f, 0.010025f,
|
||||
-0.0268555f, 0.614746f, 0.52832f, 0.0102921f, 0.100098f, 0.23291f, 0.000778198f,
|
||||
-0.00404358f
|
||||
};
|
||||
|
||||
const SkScalar LiberationMonoItalicPoints[] = {
|
||||
@ -3609,8 +3611,9 @@ const SkFixed LiberationMonoItalicWidths[] = {
|
||||
const int LiberationMonoItalicCharCodesCount = (int) SK_ARRAY_COUNT(LiberationMonoItalicCharCodes);
|
||||
|
||||
const SkPaint::FontMetrics LiberationMonoItalicMetrics = {
|
||||
0x30307833, -0.83252f, -0.83252f, 0.300293f, 0.300293f, 0, 0.798828f, 0.0124817f,
|
||||
-0.0942383f, 0.70459f, 0.538086f, 0.0104446f, 0.0410156f, 0.23291f
|
||||
0x0000000f, -0.833496f, -0.833496f, 0.300293f, 0.300293f, 0, 0.600098f, 0.0124817f,
|
||||
-0.0942383f, 0.70459f, 0.52832f, 0.0102921f, 0.0410156f, 0.23291f, 0.000778198f,
|
||||
-0.00404358f
|
||||
};
|
||||
|
||||
const SkScalar LiberationMonoBoldItalicPoints[] = {
|
||||
@ -4842,6 +4845,8 @@ const SkFixed LiberationMonoBoldItalicWidths[] = {
|
||||
const int LiberationMonoBoldItalicCharCodesCount = (int) SK_ARRAY_COUNT(LiberationMonoBoldItalicCharCodes);
|
||||
|
||||
const SkPaint::FontMetrics LiberationMonoBoldItalicMetrics = {
|
||||
0x30307833, -0.83252f, -0.83252f, 0.300293f, 0.300293f, 0, 0.791992f, 0.0123749f,
|
||||
-0.0942383f, 0.697754f, 0.538086f, 0.0104446f, 0.100098f, 0.23291f
|
||||
0x0000000f, -0.83252f, -0.83252f, 0.300293f, 0.300293f, 0, 0.600098f, 0.0123749f,
|
||||
-0.0942383f, 0.697754f, 0.52832f, 0.0102921f, 0.100098f, 0.23291f, 0.000778198f,
|
||||
-0.00404358f
|
||||
};
|
||||
|
||||
|
@ -1187,8 +1187,9 @@ const SkFixed LiberationSansNormalWidths[] = {
|
||||
const int LiberationSansNormalCharCodesCount = (int) SK_ARRAY_COUNT(LiberationSansNormalCharCodes);
|
||||
|
||||
const SkPaint::FontMetrics LiberationSansNormalMetrics = {
|
||||
0x30307833, -0.910156f, -0.905273f, 0.211914f, 0.303223f, 0.0327148f, 1.25342f, 0.0195847f,
|
||||
-0.203125f, 1.05029f, 0.538086f, 0.0109024f, 0.0732422f, 0.105957f
|
||||
0x0000000f, -0.910156f, -0.905273f, 0.211914f, 0.303223f, 0.0327148f, 0.589355f, 0.0195847f,
|
||||
-0.203125f, 1.05029f, 0.52832f, 0.0107498f, 0.0732422f, 0.105957f, 0.000778198f,
|
||||
-0.00404358f
|
||||
};
|
||||
|
||||
const SkScalar LiberationSansBoldPoints[] = {
|
||||
@ -2351,8 +2352,8 @@ const SkFixed LiberationSansBoldWidths[] = {
|
||||
const int LiberationSansBoldCharCodesCount = (int) SK_ARRAY_COUNT(LiberationSansBoldCharCodes);
|
||||
|
||||
const SkPaint::FontMetrics LiberationSansBoldMetrics = {
|
||||
0x30307833, -1.0332f, -0.905273f, 0.211914f, 0.303223f, 0.0327148f, 1.24609f, 0.0194702f,
|
||||
-0.184082f, 1.06201f, 0.538086f, 0.0109024f, 0.10498f, 0.105957f
|
||||
0x0000000f, -1.0332f, -0.905273f, 0.211914f, 0.303223f, 0.0327148f, 0.612305f, 0.0194702f,
|
||||
-0.184082f, 1.06201f, 0.52832f, 0.0107498f, 0.10498f, 0.105957f, 0.000778198f, -0.00404358f
|
||||
};
|
||||
|
||||
const SkScalar LiberationSansItalicPoints[] = {
|
||||
@ -3592,8 +3593,8 @@ const SkFixed LiberationSansItalicWidths[] = {
|
||||
const int LiberationSansItalicCharCodesCount = (int) SK_ARRAY_COUNT(LiberationSansItalicCharCodes);
|
||||
|
||||
const SkPaint::FontMetrics LiberationSansItalicMetrics = {
|
||||
0x30307833, -1.01416f, -0.905273f, 0.211914f, 0.303223f, 0.0327148f, 1.33447f, 0.0208511f,
|
||||
-0.271973f, 1.0625f, 0.537598f, 0.0109024f, 0.0732422f, 0.105957f
|
||||
0x0000000f, -1.01416f, -0.905273f, 0.211914f, 0.303223f, 0.0327148f, 0.590332f, 0.0208511f,
|
||||
-0.271973f, 1.0625f, 0.52832f, 0.0107498f, 0.0732422f, 0.105957f, 0.000778198f, -0.00404358f
|
||||
};
|
||||
|
||||
const SkScalar LiberationSansBoldItalicPoints[] = {
|
||||
@ -4852,6 +4853,7 @@ const SkFixed LiberationSansBoldItalicWidths[] = {
|
||||
const int LiberationSansBoldItalicCharCodesCount = (int) SK_ARRAY_COUNT(LiberationSansBoldItalicCharCodes);
|
||||
|
||||
const SkPaint::FontMetrics LiberationSansBoldItalicMetrics = {
|
||||
0x30307833, -1.02979f, -0.905273f, 0.211914f, 0.303223f, 0.0327148f, 1.3374f, 0.0208969f,
|
||||
-0.208984f, 1.12842f, 0.537598f, 0.0109024f, 0.10498f, 0.105957f
|
||||
0x0000000f, -1.02979f, -0.905273f, 0.211914f, 0.303223f, 0.0327148f, 0.61377f, 0.0208969f,
|
||||
-0.208984f, 1.12842f, 0.52832f, 0.0107498f, 0.10498f, 0.105957f, 0.000778198f, -0.00404358f
|
||||
};
|
||||
|
||||
|
@ -1264,8 +1264,9 @@ const SkFixed LiberationSerifNormalWidths[] = {
|
||||
const int LiberationSerifNormalCharCodesCount = (int) SK_ARRAY_COUNT(LiberationSerifNormalCharCodes);
|
||||
|
||||
const SkPaint::FontMetrics LiberationSerifNormalMetrics = {
|
||||
0x30307833, -0.981445f, -0.891113f, 0.216309f, 0.303223f, 0.0424805f, 1.18359f, 0.0184937f,
|
||||
-0.176758f, 1.00684f, 0.469727f, 0.0103607f, 0.0488281f, 0.108887f
|
||||
0x0000000f, -0.981445f, -0.891113f, 0.216309f, 0.303223f, 0.0424805f, 0.567383f, 0.0184937f,
|
||||
-0.176758f, 1.00684f, 0.458984f, 0.010231f, 0.0488281f, 0.108887f, 0.000762939f,
|
||||
-0.00320435f
|
||||
};
|
||||
|
||||
const SkScalar LiberationSerifBoldPoints[] = {
|
||||
@ -2514,8 +2515,9 @@ const SkFixed LiberationSerifBoldWidths[] = {
|
||||
const int LiberationSerifBoldCharCodesCount = (int) SK_ARRAY_COUNT(LiberationSerifBoldCharCodes);
|
||||
|
||||
const SkPaint::FontMetrics LiberationSerifBoldMetrics = {
|
||||
0x30307833, -1.00781f, -0.891113f, 0.216309f, 0.303223f, 0.0424805f, 1.26709f, 0.0197983f,
|
||||
-0.182129f, 1.08496f, 0.469727f, 0.0103607f, 0.0952148f, 0.108887f
|
||||
0x0000000f, -1.00781f, -0.891113f, 0.216309f, 0.303223f, 0.0424805f, 0.59375f, 0.0197983f,
|
||||
-0.182129f, 1.08496f, 0.458984f, 0.010231f, 0.0952148f, 0.108887f, 0.000778198f,
|
||||
-0.00404358f
|
||||
};
|
||||
|
||||
const SkScalar LiberationSerifItalicPoints[] = {
|
||||
@ -3832,8 +3834,9 @@ const SkFixed LiberationSerifItalicWidths[] = {
|
||||
const int LiberationSerifItalicCharCodesCount = (int) SK_ARRAY_COUNT(LiberationSerifItalicCharCodes);
|
||||
|
||||
const SkPaint::FontMetrics LiberationSerifItalicMetrics = {
|
||||
0x30307833, -0.980957f, -0.891113f, 0.216309f, 0.303223f, 0.0424805f, 1.26465f, 0.0197601f,
|
||||
-0.176758f, 1.08789f, 0.469727f, 0.0103607f, 0.0488281f, 0.108887f
|
||||
0x0000000f, -0.980957f, -0.891113f, 0.216309f, 0.303223f, 0.0424805f, 0.559082f, 0.0197601f,
|
||||
-0.176758f, 1.08789f, 0.458984f, 0.010231f, 0.0488281f, 0.108887f, 0.000778198f,
|
||||
-0.00404358f
|
||||
};
|
||||
|
||||
const SkScalar LiberationSerifBoldItalicPoints[] = {
|
||||
@ -5144,6 +5147,8 @@ const SkFixed LiberationSerifBoldItalicWidths[] = {
|
||||
const int LiberationSerifBoldItalicCharCodesCount = (int) SK_ARRAY_COUNT(LiberationSerifBoldItalicCharCodes);
|
||||
|
||||
const SkPaint::FontMetrics LiberationSerifBoldItalicMetrics = {
|
||||
0x30307833, -0.980957f, -0.891113f, 0.216309f, 0.303223f, 0.0424805f, 1.32861f, 0.0207596f,
|
||||
-0.178223f, 1.15039f, 0.469727f, 0.0103607f, 0.0952148f, 0.108887f
|
||||
0x0000000f, -0.980957f, -0.891113f, 0.216309f, 0.303223f, 0.0424805f, 0.578125f, 0.0207596f,
|
||||
-0.178223f, 1.15039f, 0.458984f, 0.010231f, 0.0952148f, 0.108887f, 0.000778198f,
|
||||
-0.00404358f
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user