Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[makeotf] STAT AxisValue input should be floats #1166

Merged
merged 1 commit into from
Jun 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 27 additions & 22 deletions c/makeotf/makeotf_lib/build/hotpccts/featgram.g
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,9 @@ hotCtx g;
#token K_VertAdvanceY "VertAdvanceY"

#token T_FONTREV "[0-9]+.[0-9]+"
#token T_NUMEXT "({\-}0x[0-9a-fA-F]+)|0[0-7]+"
#token T_NUM "({\-}[1-9][0-9]*)|0"
#token T_NUMEXT "0x[0-9a-fA-F]+|0[0-7]+"
#token T_NUM "({\-}[1-9][0-9]*)|{\-}0"
#token T_FLOAT "\-[0-9]+.[0-9]+"

#token T_GCLASS "\@[A-Za-z_0-9.\-]+"
#token T_CID "\\[0-9]+"
Expand Down Expand Up @@ -461,23 +462,6 @@ numUInt16Ext>[unsigned value]
>>
;

/* Extended format: hex, oct also allowed */
numInt32Ext>[int32_t value]
: <<$value = 0; /* Suppress optimizer warning */
h->linenum = zzline;>>
m:T_NUMEXT <<
if ($m.lval < INT_MIN || $m.lval > INT_MAX)
zzerr("not in range -(1<<31) .. ((1<<31) -1)");
$value = (int32_t)($m).lval;
>>
|
n:T_NUM <<
if ($n.lval < INT_MIN || $n.lval > INT_MAX)
zzerr("not in range -(1<<31) .. ((1<<31) -1)");
$value = (int32_t)($n).lval;
>>
;

/* Extended format: hex, oct also allowed */
numUInt32Ext>[unsigned value]
: <<$value = 0; /* Suppress optimizer warning */
Expand All @@ -495,6 +479,27 @@ numUInt32Ext>[unsigned value]
>>
;

/* 32-bit signed fixed-point number (16.16) */
numFixed>[Fixed value]
: <<
int64_t retval = 0;
$value = 0; /* Suppress optimizer warning */
h->linenum = zzline;
>>
(
f:T_FLOAT <<retval = floor(0.5 + strtod($f.text, NULL) * 65536);>>
|
d:T_FONTREV <<retval = floor(0.5 + strtod($d.text, NULL) * 65536);>>
|
n:T_NUM <<retval = $n.lval * 65536;>>
)
<<
if (retval < INT_MIN || retval > INT_MAX)
zzerr("not in range -32768.0 .. 32767.99998");
$value = (Fixed)retval;
>>
;

metric>[short value]
: numInt16>[$value]

Expand Down Expand Up @@ -1997,10 +2002,10 @@ axisValueFlags>[uint16_t flags]

axisValueLocation>[uint16_t format, Tag tag, Fixed value, Fixed min, Fixed max]
:
K_location t:T_TAG << $tag = $t.ulval; >> numInt32Ext>[$value]
K_location t:T_TAG << $tag = $t.ulval; >> numFixed>[$value]
( ";" << $format = 1; >>
| numInt32Ext>[$min] << $format = 3; >>
{"\-" numInt32Ext>[$max] << $format = 2; >> } ";"
| numFixed>[$min] << $format = 3; >>
{"\-" numFixed>[$max] << $format = 2; >> } ";"
)
;

Expand Down
549 changes: 285 additions & 264 deletions c/makeotf/makeotf_lib/source/hotconv/featerr.c

Large diffs are not rendered by default.

Loading