[Dev-luatex] pdfliteral after text/rules

Hartmut Henkel hartmut_henkel at gmx.de
Wed Sep 21 22:30:02 CEST 2005


On Wed, 21 Sep 2005, Hans Hagen wrote:

> Taco Hoekwater wrote:
>
> > Shall I just apply this patch to the CVS version?
>
> sure

yes, talked about it already with Thanh. Should be ok. But i was
reluctant, as there should be an inofficial pdftex version first which
Hans can power-crash-test on his complicated graphics and transforms. I
had forgotten that -- Hey! -- that inofficial version is pdfluatex :-)

Please take the attached patch, just one code line is simplified.

And thanks a lot, Taco!

Regards, Hartmut
-------------- next part --------------
%$Id: rule.ch,v 1.4 2005/09/17 19:57:25 hahe Exp hahe $
% rule in a group
%***********************************************************************

@x 15882
@p procedure pdf_set_origin; {set the origin to |cur_h|, |cur_v|}
begin
    if (abs(cur_h - pdf_origin_h) >= min_bp_val) or
        (abs(cur_v - pdf_origin_v) >= min_bp_val) then begin
        pdf_print("1 0 0 1 ");
        pdf_print_bp(cur_h - pdf_origin_h);
        pdf_origin_h := pdf_origin_h + scaled_out;
        pdf_out(" ");
        pdf_print_bp(pdf_origin_v - cur_v);
        pdf_origin_v := pdf_origin_v - scaled_out;
        pdf_print_ln(" cm");
    end;
    pdf_h := pdf_origin_h;
    pdf_last_h := pdf_origin_h;
    pdf_v := pdf_origin_v;
    pdf_last_v := pdf_origin_v;
end;
@y
@p procedure pdf_set_origin; {set the origin to |cur_h|, |cur_v|}
begin
    if (abs(cur_h - pdf_origin_h) >= min_bp_val) or
        (abs(cur_v - pdf_origin_v) >= min_bp_val) then begin
        pdf_print("1 0 0 1 ");
        pdf_print_bp(cur_h - pdf_origin_h);
        pdf_origin_h := pdf_origin_h + scaled_out;
        pdf_out(" ");
        pdf_print_bp(pdf_origin_v - cur_v);
        pdf_origin_v := pdf_origin_v - scaled_out;
        pdf_print_ln(" cm");
    end;
    pdf_h := pdf_origin_h;
    pdf_last_h := pdf_origin_h;
    pdf_v := pdf_origin_v;
    pdf_last_v := pdf_origin_v;
end;

@
@p procedure pdf_set_origin_temp; {set the origin to |cur_h|, |cur_v| inside group}
var h_bp, v_bp: scaled; {current position (bp system)}
begin
    if (abs(cur_h - pdf_origin_h) >= min_bp_val) or
        (abs(cur_v - pdf_origin_v) >= min_bp_val) then begin
        pdf_print("1 0 0 1 ");
        pdf_print_bp(cur_h - pdf_origin_h);
        pdf_out(" ");
        pdf_print_bp(pdf_origin_v - cur_v);
        pdf_print_ln(" cm");
    end;
end;
@z

%***********************************************************************

@x 16045
procedure pdf_set_rule(x, y, w, h: scaled); {draw a rule}
begin
    pdf_end_text;
    pdf_set_origin;
    if h <= one_bp then begin
        pdf_print_ln("q");
        pdf_print_ln("[]0 d");
        pdf_print_ln("0 J");
        pdf_print_bp(h); pdf_print_ln(" w");
        pdf_print("0 "); pdf_print_bp((h + 1)/2); pdf_print_ln(" m");
        pdf_print_bp(w); pdf_print(" "); pdf_print_bp((h + 1)/2);
        pdf_print_ln(" l");
        pdf_print_ln("S");
        pdf_print_ln("Q");
    end
    else if w <= one_bp then begin
        pdf_print_ln("q");
        pdf_print_ln("[]0 d");
        pdf_print_ln("0 J");
        pdf_print_bp(w); pdf_print_ln(" w");
        pdf_print_bp((w + 1)/2); pdf_print_ln(" 0 m");
        pdf_print_bp((w + 1)/2); pdf_print(" "); pdf_print_bp(h);
        pdf_print_ln(" l");
        pdf_print_ln("S");
        pdf_print_ln("Q");
    end
    else begin
        pdf_print_bp(pdf_x(x)); pdf_out(" ");
        pdf_print_bp(pdf_y(y)); pdf_out(" ");
        pdf_print_bp(w); pdf_out(" ");
        pdf_print_bp(h); pdf_print_ln(" re f");
    end;
end;

@y
procedure pdf_set_rule(x, y, w, h: scaled); {draw a rule}
var temp_cur_h, temp_cur_v: scaled;
begin
    pdf_end_text;
    pdf_print_ln("q");
    pdf_set_origin_temp;
    if h <= one_bp then begin
        pdf_print("[]0 d 0 J ");
        pdf_print_bp(h); pdf_print_ln(" w");
        pdf_print("0 "); pdf_print_bp((h + 1)/2); pdf_print(" m ");
        pdf_print_bp(w); pdf_print(" "); pdf_print_bp((h + 1)/2);
        pdf_print_ln(" l S");
    end
    else if w <= one_bp then begin
        pdf_print("[]0 d 0 J ");
        pdf_print_bp(w); pdf_print_ln(" w");
        pdf_print_bp((w + 1)/2); pdf_print(" 0 m ");
        pdf_print_bp((w + 1)/2); pdf_print(" "); pdf_print_bp(h);
        pdf_print_ln(" l S");
    end
    else begin
        pdf_print_("0 0 ");
        pdf_print_bp(w); pdf_out(" ");
        pdf_print_bp(h); pdf_print_ln(" re f");
    end;
    pdf_print_ln("Q");
end;
@z

%***********************************************************************


More information about the Dev-luatex mailing list