summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/pdf/pdfglyph.w
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2014-02-03 13:01:31 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2014-02-03 13:01:31 +0000
commit4dc568b1e2c01476f34b6c014da3bc487b71aacf (patch)
treea6a389e1a3915bdc1b618eb2aeae27fd7f21b68a /Build/source/texk/web2c/luatexdir/pdf/pdfglyph.w
parent4a985ab4153e6ba130b801d4cec60709b0a44e47 (diff)
Import LuaTeX snapshot 0.78.3
git-svn-id: svn://tug.org/texlive/trunk@32854 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/pdf/pdfglyph.w')
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfglyph.w80
1 files changed, 56 insertions, 24 deletions
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfglyph.w b/Build/source/texk/web2c/luatexdir/pdf/pdfglyph.w
index f1b92379154..c9fa5775198 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfglyph.w
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfglyph.w
@@ -19,8 +19,8 @@
@ @c
static const char _svn_version[] =
- "$Id: pdfglyph.w 4575 2013-02-08 20:42:52Z hhenkel $"
- "$URL: https://foundry.supelec.fr/svn/luatex/tags/beta-0.76.0/source/texk/web2c/luatexdir/pdf/pdfglyph.w $";
+ "$Id: pdfglyph.w 4718 2014-01-02 15:35:31Z taco $"
+ "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdfglyph.w $";
#include "ptexlib.h"
#include "pdf/pdfpage.h"
@@ -46,14 +46,13 @@ void pdf_print_charwidth(PDF pdf, internal_font_number f, int i)
{
pdffloat cw;
pdfstructure *p = pdf->pstruct;
- assert(pdf_font_blink(f) == null_font); /* must use unexpanded font! */
cw.m = pdf_char_width(p, f, i);
cw.e = p->cw.e;
print_pdffloat(pdf, cw);
}
@ @c
-static void setup_fontparameters(PDF pdf, internal_font_number f)
+static void setup_fontparameters(PDF pdf, internal_font_number f, int ex_glyph)
{
float slant, extend, expand, scale = 1.0;
float u = 1.0;
@@ -68,7 +67,7 @@ static void setup_fontparameters(PDF pdf, internal_font_number f)
p->fs.m = i64round(font_size(f) / u / one_bp * ten_pow[p->fs.e]);
slant = font_slant(f) / 1000.0;
extend = font_extend(f) / 1000.0;
- expand = 1.0 + font_expand_ratio(f) / 1000.0;
+ expand = 1.0 + (ex_glyph/1) / 1000.0;
p->tj_delta.e = p->cw.e - 1; /* "- 1" makes less corrections inside []TJ */
/* no need to be more precise than TeX (1sp) */
while (p->tj_delta.e > 0
@@ -82,7 +81,9 @@ static void setup_fontparameters(PDF pdf, internal_font_number f)
ten_pow[e_tj +
p->cw.e] * scale / (ten_pow[p->pdf.h.e] * pdf2double(p->fs) *
pdf2double(p->tm[0]));
-}
+ p->cur_ex = ex_glyph ; /* we keep track of the state of ex */
+}
+
@ @c
static void set_font(PDF pdf)
@@ -192,29 +193,60 @@ void end_chararray(PDF pdf)
}
@ @c
-void pdf_place_glyph(PDF pdf, internal_font_number f, int c)
+void pdf_place_glyph(PDF pdf, internal_font_number f, int c, int ex)
{
boolean move;
pdfstructure *p = pdf->pstruct;
scaledpos pos = pdf->posstruct->pos;
+
if (!char_exists(f, c))
return;
- /* ensure to be within BT...ET */
- if (is_pagemode(p)) {
- pdf_goto_textmode(pdf);
- p->need_tf = true;
- }
- /* all font setup */
- if (f != pdf->f_cur || p->need_tf) {
- setup_fontparameters(pdf, f);
- if (p->need_tf || p->f_pdf != p->f_pdf_cur || p->fs.m != p->fs_cur.m) {
- pdf_goto_textmode(pdf);
- set_font(pdf);
- } else if (p->tm0_cur.m != p->tm[0].m) {
- /* catch in-line HZ expand change due to efcode */
- p->need_tm = true;
- }
- }
+
+/*
+ p->need_tf : okay, set somewhere else
+ f != pdf->f_cur : font change
+ p->f_pdf != p->f_pdf_cur : font change
+ p->fs.m ~= p->fs_cur.m : move
+ is_pagemode(p) -> stream change
+ p->tm0_cur.m -> p->tm[0].m : also move
+*/
+
+ /* fix issue 857 */
+ /* /\* ensure to be within BT...ET *\/ */
+ /* if (is_pagemode(p)) { */
+ /* pdf_goto_textmode(pdf); */
+ /* p->need_tf = true; */
+ /* } */
+ /* /\* all font setup *\/ */
+ /* if (true || f != pdf->f_cur || p->need_tf) { */
+ /* setup_fontparameters(pdf, f, ex); */
+ /* if (p->need_tf || p->f_pdf != p->f_pdf_cur || p->fs.m != p->fs_cur.m) { */
+ /* pdf_goto_textmode(pdf); */
+ /* set_font(pdf); */
+ /* } else if (p->tm0_cur.m != p->tm[0].m) { */
+ /* /\* catch in-line HZ expand change due to efcode *\/ */
+ /* p->need_tm = true; */
+ /* } */
+ /* } */
+
+
+ /* LS/HH: We need to adapt the tm when a font changes. A change can be a change in
+ id (frontend) or pdf reference (backend, as we share font resources). At
+ such a change we also need to adapt to the slant and extend. Initially
+ we also need to take the exfactor of a glyph into account. When the font is
+ unchanged, we still need to check each glyph for a change in exfactor. We
+ store the current one on the state record so that we can minimize testing. */
+
+ /* is the p->need_tf test really needed ? */
+ if (p->need_tf || f != pdf->f_cur || p->f_pdf != p->f_pdf_cur || p->fs.m != p->fs_cur.m || is_pagemode(p)) {
+ pdf_goto_textmode(pdf);
+ setup_fontparameters(pdf, f, ex);
+ set_font(pdf);
+ } else if (p->tm0_cur.m != p->tm[0].m || p->cur_ex != ex) {
+ setup_fontparameters(pdf, f, ex);
+ p->need_tm = true;
+ }
+
/* all movements */
move = calc_pdfpos(p, pos); /* within text or chararray or char mode */
if (move || p->need_tm) {
@@ -222,7 +254,7 @@ void pdf_place_glyph(PDF pdf, internal_font_number f, int c)
&& (p->pdf_bt_pos.v.m + p->tm[5].m) != p->pdf.v.m)
|| (p->wmode == WMODE_V
&& (p->pdf_bt_pos.h.m + p->tm[4].m) != p->pdf.h.m)
- || p->tj_delta.m >= 1000000 || p->tj_delta.m <= -1000000) {
+ || abs(p->tj_delta.m) >= 1000000) {
pdf_goto_textmode(pdf);
set_textmatrix(pdf, pos);
begin_chararray(pdf);