diff options
author | Taco Hoekwater <taco@elvenkind.com> | 2009-06-03 13:40:46 +0000 |
---|---|---|
committer | Taco Hoekwater <taco@elvenkind.com> | 2009-06-03 13:40:46 +0000 |
commit | dd3bed371f5139080aad1cf587daf867f6135b6d (patch) | |
tree | 7ff3798111df6973a19f15af7a102103cd8250c7 /Build/source/texk/web2c/luatexdir/font/tfmofm.c | |
parent | f1ac6f3e0cfbdd6d2d1ab9f5225c2af340039b09 (diff) |
sources for luatex 0.40.2
git-svn-id: svn://tug.org/texlive/trunk@13604 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/font/tfmofm.c')
-rw-r--r-- | Build/source/texk/web2c/luatexdir/font/tfmofm.c | 56 |
1 files changed, 50 insertions, 6 deletions
diff --git a/Build/source/texk/web2c/luatexdir/font/tfmofm.c b/Build/source/texk/web2c/luatexdir/font/tfmofm.c index 1172b457371..164676afa97 100644 --- a/Build/source/texk/web2c/luatexdir/font/tfmofm.c +++ b/Build/source/texk/web2c/luatexdir/font/tfmofm.c @@ -22,7 +22,7 @@ #include "luatexfont.h" static const char _svn_version[] = - "$Id: tfmofm.c 2306 2009-04-16 15:01:45Z taco $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/tfmofm.c $"; + "$Id: tfmofm.c 2414 2009-06-03 12:57:01Z taco $ $URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.40.2/source/texk/web2c/luatexdir/font/tfmofm.c $"; /* Here are some macros that help process ligatures and kerns */ @@ -508,13 +508,57 @@ open_tfm_file(char *nom, unsigned char **tfm_buf, integer * tfm_siz) of \TeX\ between computers. */ -#define store_scaled(zz) \ - { fget; a=fbyte; fget; b=fbyte; \ - fget; c=fbyte; fget; d=fbyte; \ - sw=(((((d*z)>>8)+(c*z))>>8)+(b*z)) / beta; \ - if (a==0) { zz=sw; } else if (a==255) { zz=sw-alpha; } else tfm_abort; \ +#define store_scaled(zz) \ + { fget; a=fbyte; fget; b=fbyte; \ + fget; c=fbyte; fget; d=fbyte; \ + sw=(((((d*z)>>8)+(c*z))>>8)+(b*z)) / beta; \ + if (a==0) { zz=sw; } else if (a==255) { zz=sw-alpha; } else tfm_abort; \ } +scaled store_scaled_f(scaled sq, scaled z_in) +{ + eight_bits a, b, c, d; + scaled sw; + static integer alpha, beta; /* beta:1..16 */ + static scaled z, z_prev = 0; + /* @<Replace |z| by $|z|^\prime$ and compute $\alpha,\beta$@>; */ + if (z_in != z_prev || z_prev == 0) { + z = z_prev = z_in; + alpha = 16; + while (z >= 0x800000) { + z /= 2; + alpha += alpha; + } + beta = 256 / alpha; + alpha *= z; + }; + if (sq >= 0) { + d = sq % 256; /* any "mod 256" not really needed, would typecast alone be safe? */ + sq = sq / 256; + c = sq % 256; + sq = sq / 256; + b = sq % 256; + sq = sq / 256; + a = sq % 256; + } else { + sq = (sq + 1073741824) + 1073741824; /* braces for optimizing compiler */ + d = sq % 256; + sq = sq / 256; + c = sq % 256; + sq = sq / 256; + b = sq % 256; + sq = sq / 256; + a = (sq + 128) % 256; + } + sw = (((((d * z) >> 8) + (c * z)) >> 8) + (b * z)) / beta; + if (a == 0) + return sw; + else if (a == 255) + return (sw - alpha); + else + pdf_error(maketexstring("vf"), maketexstring("vf scaling")); +} + #define check_existence(z) \ { check_byte_range(z); \ if (!char_exists(f,z)) tfm_abort; \ |