Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP7:GA
fonttosfnt.20912
0014-use-PIXEL_SIZE-to-calculate-lineGap.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0014-use-PIXEL_SIZE-to-calculate-lineGap.patch of Package fonttosfnt.20912
From 9b8222a8b4942d1b21a209d518373cb5a23ed50f Mon Sep 17 00:00:00 2001 From: Christopher Zimmermann <madroach@gmerlin.de> Date: Sun, 16 Aug 2020 21:56:15 +0200 Subject: [PATCH 14/14] use PIXEL_SIZE to calculate lineGap --- fonttosfnt.h | 1 + read.c | 1 + write.c | 16 ++++++++++++---- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/fonttosfnt.h b/fonttosfnt.h index 6ad30fb..0dcc31c 100644 --- a/fonttosfnt.h +++ b/fonttosfnt.h @@ -88,6 +88,7 @@ typedef struct _FontNameEntry { typedef struct _Metrics { int height; + int size; int maxX; int minX; int maxY; diff --git a/read.c b/read.c index 67716a0..b1e02a0 100644 --- a/read.c +++ b/read.c @@ -296,6 +296,7 @@ readFile(char *filename, FontPtr font) font->foundry = faceFoundry(face); font->italicAngle = faceItalicAngle(face); font->pxMetrics.height = face->available_sizes[0].height; + font->pxMetrics.size = faceIntProp(face, "PIXEL_SIZE"); font->pxMetrics.xHeight = faceIntProp(face, "X_HEIGHT"); font->pxMetrics.capHeight = faceIntProp(face, "CAP_HEIGHT"); font->pxMetrics.ascent = faceIntProp(face, "FONT_ASCENT"); diff --git a/write.c b/write.c index 4bb86dd..4fede15 100644 --- a/write.c +++ b/write.c @@ -238,7 +238,15 @@ fontMetrics(FontPtr font) if (count) font->metrics.awidth = sumAwidth / count; - font->metrics.height = UNDEF /* TODO */; + font->metrics.height = TWO_SIXTEENTH; + + if(font->pxMetrics.size == UNDEF) { + font->pxMetrics.size = font->pxMetrics.height; + font->metrics.size = font->metrics.height; + } + + font->metrics.size = font->pxMetrics.size + * TWO_SIXTEENTH / font->pxMetrics.height; if(font->pxMetrics.ascent == UNDEF) { font->metrics.ascent = font->metrics.maxY; @@ -943,7 +951,7 @@ writehhea(FILE* out, FontPtr font) writeULONG(out, 0x00010000); /* version */ writeSHORT(out, FONT_UNITS_CEIL(font->metrics.ascent)); /* ascender */ writeSHORT(out, -FONT_UNITS_CEIL(font->metrics.descent)); /* descender */ - writeSHORT(out, 0); /* lineGap */ + writeSHORT(out, FONT_UNITS(font->metrics.size - font->metrics.ascent - font->metrics.descent)); /* lineGap */ writeUSHORT(out, FONT_UNITS(font->metrics.maxAwidth)); /* advanceWidthMax */ /* TODO: the next three are not calculated according to spec, are they ? * https://docs.microsoft.com/en-us/typography/opentype/spec/hhea */ @@ -1118,8 +1126,8 @@ writeOS2(FILE* out, FontPtr font) writeUSHORT(out, 0x20); /* usFirstCharIndex; */ writeUSHORT(out, 0xFFFD); /* usLastCharIndex; */ writeUSHORT(out, FONT_UNITS_CEIL(font->metrics.ascent)); /* sTypoAscender; */ - writeUSHORT(out, -FONT_UNITS_CEIL(font->metrics.descent)); /* sTypoDescender; */ - writeUSHORT(out, 0); /* sTypoLineGap; */ + writeSHORT(out, -FONT_UNITS_CEIL(font->metrics.descent)); /* sTypoDescender; */ + writeSHORT(out, FONT_UNITS(font->metrics.size - font->metrics.ascent - font->metrics.descent)); /* sTypoLineGap */ #ifdef NO_TYPO_METRICS writeUSHORT(out, FONT_UNITS_CEIL(font->metrics.ascent)); /* usWinAscent; */ writeUSHORT(out, FONT_UNITS_CEIL(font->metrics.descent)); /* usWinDescent; */ -- 2.28.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor