summaryrefslogtreecommitdiff
path: root/Build/source/texk
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk')
-rw-r--r--Build/source/texk/web2c/pdftexdir/epdf.h1
-rw-r--r--Build/source/texk/web2c/pdftexdir/image.h2
-rw-r--r--Build/source/texk/web2c/pdftexdir/pdftex.ch4
-rw-r--r--Build/source/texk/web2c/pdftexdir/pdftex.defines1
-rw-r--r--Build/source/texk/web2c/pdftexdir/pdftex.web76
-rw-r--r--Build/source/texk/web2c/pdftexdir/pdftoepdf.cc28
-rw-r--r--Build/source/texk/web2c/pdftexdir/ptexlib.h1
-rw-r--r--Build/source/texk/web2c/pdftexdir/writefont.c3
-rw-r--r--Build/source/texk/web2c/pdftexdir/writeimg.c8
9 files changed, 79 insertions, 45 deletions
diff --git a/Build/source/texk/web2c/pdftexdir/epdf.h b/Build/source/texk/web2c/pdftexdir/epdf.h
index 59abe26d9a8..d1f2a2c818f 100644
--- a/Build/source/texk/web2c/pdftexdir/epdf.h
+++ b/Build/source/texk/web2c/pdftexdir/epdf.h
@@ -49,6 +49,7 @@ extern "C" {
extern float epdf_height;
extern float epdf_orig_x;
extern float epdf_orig_y;
+ extern float epdf_rotate;
extern integer epdf_selected_page;
extern integer epdf_num_pages;
extern integer epdf_page_box;
diff --git a/Build/source/texk/web2c/pdftexdir/image.h b/Build/source/texk/web2c/pdftexdir/image.h
index e54145c0582..638dfe0331e 100644
--- a/Build/source/texk/web2c/pdftexdir/image.h
+++ b/Build/source/texk/web2c/pdftexdir/image.h
@@ -58,6 +58,7 @@ typedef struct {
int color_type;
integer width;
integer height;
+ integer rotate;
integer x_res;
integer y_res;
integer num_pages;
@@ -94,6 +95,7 @@ extern integer image_max;
#define img_pages(N) (img_ptr(N)->num_pages)
#define img_width(N) (img_ptr(N)->width)
#define img_height(N) (img_ptr(N)->height)
+#define img_rotate(N) (img_ptr(N)->rotate)
#define img_xres(N) (img_ptr(N)->x_res)
#define img_yres(N) (img_ptr(N)->y_res)
#define png_ptr(N) (img_ptr(N)->image_struct.png.png_ptr)
diff --git a/Build/source/texk/web2c/pdftexdir/pdftex.ch b/Build/source/texk/web2c/pdftexdir/pdftex.ch
index 3acc599c4d3..299359fb492 100644
--- a/Build/source/texk/web2c/pdftexdir/pdftex.ch
+++ b/Build/source/texk/web2c/pdftexdir/pdftex.ch
@@ -325,6 +325,7 @@ vf_default_font:=xmalloc_array(internal_font_number, font_max);
vf_local_font_num:=xmalloc_array(internal_font_number, font_max);
vf_e_fnts:=xmalloc_array(integer, font_max);
vf_i_fnts:=xmalloc_array(internal_font_number, font_max);
+pdf_font_nobuiltin_tounicode:=xmalloc_array(boolean, font_max);
for font_k := font_base to font_max do begin
for k := 0 to 31 do
@@ -349,6 +350,7 @@ for font_k := font_base to font_max do begin
pdf_font_sh_bs_base[font_k] := 0;
pdf_font_kn_bc_base[font_k] := 0;
pdf_font_kn_ac_base[font_k] := 0;
+ pdf_font_nobuiltin_tounicode[font_k] := false;
end;
make_pdftex_banner;
@@ -440,6 +442,7 @@ vf_default_font:=xmalloc_array(internal_font_number,font_max);
vf_local_font_num:=xmalloc_array(internal_font_number,font_max);
vf_e_fnts:=xmalloc_array(integer,font_max);
vf_i_fnts:=xmalloc_array(internal_font_number,font_max);
+pdf_font_nobuiltin_tounicode:=xmalloc_array(boolean,font_max);
for font_k := font_base to font_max do begin
for k := 0 to 31 do
@@ -464,6 +467,7 @@ for font_k := font_base to font_max do begin
pdf_font_sh_bs_base[font_k] := 0;
pdf_font_kn_bc_base[font_k] := 0;
pdf_font_kn_ac_base[font_k] := 0;
+ pdf_font_nobuiltin_tounicode[font_k] := false;
end;
font_ptr:=null_font; fmem_ptr:=7;
diff --git a/Build/source/texk/web2c/pdftexdir/pdftex.defines b/Build/source/texk/web2c/pdftexdir/pdftex.defines
index 5ea4c4e450a..b599d1b5422 100644
--- a/Build/source/texk/web2c/pdftexdir/pdftex.defines
+++ b/Build/source/texk/web2c/pdftexdir/pdftex.defines
@@ -109,6 +109,7 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
@define function epdforigx();
@define function epdforigy();
@define function imageheight();
+@define function imagerotate();
@define function imagepages();
@define function imagecolordepth();
@define function imagegroupref();
diff --git a/Build/source/texk/web2c/pdftexdir/pdftex.web b/Build/source/texk/web2c/pdftexdir/pdftex.web
index e061e20cb33..701eae8173c 100644
--- a/Build/source/texk/web2c/pdftexdir/pdftex.web
+++ b/Build/source/texk/web2c/pdftexdir/pdftex.web
@@ -11180,8 +11180,10 @@ end;
pdf_page_ref_code: print_int(get_obj(obj_type_page, cur_val, false));
left_margin_kern_code: begin
p := list_ptr(box(cur_val));
- if (p <> null) and (not is_char_node(p)) and
- (type(p) = glue_node) and (subtype(p) = left_skip_code + 1) then
+ while (p <> null) and
+ (cp_skipable(p) or
+ ((not is_char_node(p)) and (type(p) = glue_node) and (subtype(p) = left_skip_code + 1)))
+ do
p := link(p);
if (p <> null) and (not is_char_node(p)) and
(type(p) = margin_kern_node) and (subtype(p) = left_side) then
@@ -11192,13 +11194,12 @@ left_margin_kern_code: begin
end;
right_margin_kern_code: begin
q := list_ptr(box(cur_val));
- p := null;
- if q <> null then begin
- p := prev_rightmost(q, null);
- if (p <> null) and (not is_char_node(p)) and
- (type(p) = glue_node) and (subtype(p) = right_skip_code + 1) then
- p := prev_rightmost(q, p);
- end;
+ p := prev_rightmost(q, null);
+ while (p <> null) and
+ (cp_skipable(p) or
+ ((not is_char_node(p)) and (type(p) = glue_node) and (subtype(p) = right_skip_code + 1)))
+ do
+ p := prev_rightmost(q, p);
if (p <> null) and (not is_char_node(p)) and
(type(p) = margin_kern_node) and (subtype(p) = right_side) then
print_scaled(width(p))
@@ -16837,6 +16838,7 @@ procedure scan_pdf_ext_toks; forward;
@ @<Glob...@>=
@!pdf_font_type: ^eight_bits; {the type of font}
@!pdf_font_attr: ^str_number; {pointer to additional attributes}
+@!pdf_font_nobuiltin_tounicode: ^boolean; {disable generating ToUnicode for this font?}
@ Here come some subroutines to deal with expanded fonts for HZ-algorithm.
@@ -33244,7 +33246,8 @@ stays the same.
@d pdf_setmatrix_node == pdftex_first_extension_code + 32
@d pdf_save_node == pdftex_first_extension_code + 33
@d pdf_restore_node == pdftex_first_extension_code + 34
-@d pdftex_last_extension_code == pdftex_first_extension_code + 34
+@d pdf_nobuiltin_tounicode_code== pdftex_first_extension_code + 35
+@d pdftex_last_extension_code == pdftex_first_extension_code + 35
@<Put each...@>=
primitive("openout",extension,open_node);@/
@@ -33329,6 +33332,8 @@ primitive("pdffontexpand",extension,pdf_font_expand_code);@/
@!@:pdf_font_expand_}{\.{\\pdffontexpand} primitive@>
primitive("pdfglyphtounicode",extension,pdf_glyph_to_unicode_code);@/
@!@:pdf_glyph_to_unicode_}{\.{\\pdfglyphtounicode} primitive@>
+primitive("pdfnobuiltintounicode",extension,pdf_nobuiltin_tounicode_code);@/
+@!@:pdf_nobuiltin_tounicode_}{\.{\\pdfnobuiltintounicode} primitive@>
@ The variable |write_loc| just introduced is used to provide an
appropriate error message in case of ``runaway'' write texts.
@@ -33378,6 +33383,7 @@ extension: case chr_code of
pdf_ximage_code: print_esc("pdfximage");
reset_timer_code: print_esc("pdfresettimer");
set_random_seed_code: print_esc("pdfsetrandomseed");
+ pdf_nobuiltin_tounicode_code: print_esc("pdfnobuiltintounicode");
pdf_glyph_to_unicode_code: print_esc("pdfglyphtounicode");
othercases print("[unknown extension!]")
endcases;
@@ -33435,6 +33441,7 @@ begin case cur_chr of
reset_timer_code: @<Implement \.{\\pdfresettimer}@>;
set_random_seed_code: @<Implement \.{\\pdfsetrandomseed}@>;
pdf_glyph_to_unicode_code: @<Implement \.{\\pdfglyphtounicode}@>;
+ pdf_nobuiltin_tounicode_code: @<Implement \.{\\pdfnobuiltintounicode}@>;
othercases confusion("ext1")
@:this can't happen ext1}{\quad ext1@>
endcases;
@@ -33840,11 +33847,21 @@ procedure scale_image(n: integer);
var x, y, xr, yr: integer; {size and resolution of image}
w, h: scaled; {indeed size corresponds to image resolution}
default_res: integer;
-begin
- x := image_width(obj_ximage_data(n));
- y := image_height(obj_ximage_data(n));
- xr := image_x_res(obj_ximage_data(n));
- yr := image_y_res(obj_ximage_data(n));
+ image: integer;
+begin
+ image := obj_ximage_data(n);
+ if (image_rotate(image) = 90) or (image_rotate(image) = 270) then begin
+ y := image_width(image);
+ x := image_height(image);
+ yr := image_x_res(image);
+ xr := image_y_res(image);
+ end else begin
+ x := image_width(image);
+ y := image_height(image);
+ xr := image_x_res(image);
+ yr := image_y_res(image);
+ end;
+
if (xr > 65535) or (yr > 65535) then begin
xr := 0;
yr := 0;
@@ -33852,7 +33869,7 @@ begin
end;
if (x <= 0) or (y <= 0) or (xr < 0) or (yr < 0) then
pdf_error("ext1", "invalid image dimensions");
- if is_pdf_image(obj_ximage_data(n)) then begin
+ if is_pdf_image(image) then begin
w := x;
h := y;
end
@@ -34710,6 +34727,16 @@ begin
glyph_to_unicode;
end
+@ @<Implement \.{\\pdfnobuiltintounicode}@>=
+begin
+ check_pdfoutput("\pdfnobuiltintounicode", true);
+ scan_font_ident;
+ k := cur_val;
+ if k = null_font then
+ pdf_error("font", "invalid font identifier");
+ pdf_font_nobuiltin_tounicode[k] := true;
+end
+
@ The following function are needed for outputing article thread.
@<Declare procedures needed in |do_ext...@>=
@@ -35962,8 +35989,17 @@ end;
procedure out_image(p: pointer);
var image, groupref: integer;
+ img_w, img_h: integer;
begin
image := obj_ximage_data(pdf_ximage_objnum(p));
+ if (image_rotate(image) = 90) or (image_rotate(image) = 270) then begin
+ img_h := image_width(image);
+ img_w := image_height(image);
+ end else begin
+ img_w := image_width(image);
+ img_h := image_height(image);
+ end;
+
pdf_end_text;
pdf_print_ln("q");
if pdf_lookup_list(pdf_ximage_list, pdf_ximage_objnum(p)) = null then
@@ -35986,18 +36022,18 @@ begin
else begin
if pdf_page_group_val<1 then pdf_page_group_val := image_group_ref (image);
pdf_print_real(ext_xn_over_d(pdf_width(p),
- ten_pow[6], image_width(image)), 6);
+ ten_pow[6], img_w), 6);
pdf_print(" 0 0 ");
pdf_print_real(ext_xn_over_d(pdf_height(p) + pdf_depth(p),
- ten_pow[6], image_height(image)), 6);
+ ten_pow[6], img_h), 6);
pdf_out(" ");
pdf_print_bp(pdf_x(cur_h) -
ext_xn_over_d(pdf_width(p), epdf_orig_x(image),
- image_width(image)));
+ img_w));
pdf_out(" ");
pdf_print_bp(pdf_y(cur_v) -
ext_xn_over_d(pdf_height(p) + pdf_depth(p), epdf_orig_y(image),
- image_height(image)));
+ img_h));
end;
pdf_print_ln(" cm");
pdf_print("/Im");
diff --git a/Build/source/texk/web2c/pdftexdir/pdftoepdf.cc b/Build/source/texk/web2c/pdftexdir/pdftoepdf.cc
index fd1b5365cb5..b687da19fc5 100644
--- a/Build/source/texk/web2c/pdftexdir/pdftoepdf.cc
+++ b/Build/source/texk/web2c/pdftexdir/pdftoepdf.cc
@@ -697,7 +697,6 @@ read_pdf_info(char *image_name, char *page_name, integer page_num,
{
PdfDocument *pdf_doc;
Page *page;
- int rotate;
PDFRectangle *pagebox;
#ifdef HAVE_GETPDFMAJORVERSION
int pdf_major_version_found, pdf_minor_version_found;
@@ -783,29 +782,10 @@ read_pdf_info(char *image_name, char *page_name, integer page_num,
epdf_height = pagebox->y1 - pagebox->y2;
}
- // handle page rotation and adjust dimens as needed
- rotate = page->getRotate();
- if (rotate != 0) {
- if (rotate % 90 == 0) {
- // handle only the simple case: multiple of 90s.
- // these are the only values allowed according to the
- // reference (v1.3, p. 78).
- // 180 needs no special treatment here
- register float f;
- switch (rotate) {
- case 90:
- f = epdf_height;
- epdf_height = epdf_width;
- epdf_width = f;
- break;
- case 270:
- f = epdf_height;
- epdf_height = epdf_width;
- epdf_width = f;
- break;
- }
- }
- }
+ // get page rotation
+ epdf_rotate = page->getRotate() % 360;
+ if (epdf_rotate < 0)
+ epdf_rotate += 360;
pdf_doc->xref = pdf_doc->doc->getXRef();
return page_num;
diff --git a/Build/source/texk/web2c/pdftexdir/ptexlib.h b/Build/source/texk/web2c/pdftexdir/ptexlib.h
index be316d9ea99..9bab56da912 100644
--- a/Build/source/texk/web2c/pdftexdir/ptexlib.h
+++ b/Build/source/texk/web2c/pdftexdir/ptexlib.h
@@ -303,6 +303,7 @@ extern integer epdforigx(integer);
extern integer epdforigy(integer);
extern integer imagecolor(integer);
extern integer imageheight(integer);
+extern integer imagerotate(integer);
extern integer imagepages(integer);
extern integer imagewidth(integer);
extern integer imagexres(integer);
diff --git a/Build/source/texk/web2c/pdftexdir/writefont.c b/Build/source/texk/web2c/pdftexdir/writefont.c
index 5752b968120..a07f43bece4 100644
--- a/Build/source/texk/web2c/pdftexdir/writefont.c
+++ b/Build/source/texk/web2c/pdftexdir/writefont.c
@@ -528,7 +528,8 @@ static void write_fontdictionary(fo_entry * fo)
assert(fo->fo_objnum != 0); /* reserved as pdf_font_num[f] in pdftex.web */
/* write ToUnicode entry if needed */
- if (fixedgentounicode > 0 && fo->fd != NULL) {
+ if (fixedgentounicode > 0 && fo->fd != NULL
+ && !pdffontnobuiltintounicode[fo->tex_font]) {
if (fo->fe != NULL) {
fo->tounicode_objnum =
write_tounicode(fo->fe->glyph_names, fo->fm->tfm_name, fo->fe->name);
diff --git a/Build/source/texk/web2c/pdftexdir/writeimg.c b/Build/source/texk/web2c/pdftexdir/writeimg.c
index 78540e0d180..de3889da13f 100644
--- a/Build/source/texk/web2c/pdftexdir/writeimg.c
+++ b/Build/source/texk/web2c/pdftexdir/writeimg.c
@@ -36,6 +36,7 @@ float epdf_width;
float epdf_height;
float epdf_orig_x;
float epdf_orig_y;
+float epdf_rotate;
integer epdf_selected_page;
integer epdf_num_pages;
integer epdf_page_box;
@@ -51,6 +52,7 @@ static integer new_image_entry(void)
image_ptr->y_res = 0;
image_ptr->width = 0;
image_ptr->height = 0;
+ image_ptr->rotate = 0;
image_ptr->colorspace_ref = 0;
image_ptr->group_ref = 0;
return image_ptr++ - image_array;
@@ -71,6 +73,11 @@ integer imageheight(integer img)
return img_height(img);
}
+integer imagerotate(integer img)
+{
+ return img_rotate(img);
+}
+
integer imagexres(integer img)
{
return img_xres(img);
@@ -309,6 +316,7 @@ integer readimage(strnumber s, integer page_num, strnumber page_name,
pdfversion, pdfinclusionerrorlevel);
img_width(img) = bp2int(epdf_width);
img_height(img) = bp2int(epdf_height);
+ img_rotate(img) = epdf_rotate;
img_pages(img) = epdf_num_pages;
pdf_ptr(img)->orig_x = bp2int(epdf_orig_x);
pdf_ptr(img)->orig_y = bp2int(epdf_orig_y);