summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/pdf/pdfgen.c
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/pdf/pdfgen.c')
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfgen.c42
1 files changed, 38 insertions, 4 deletions
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.c b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.c
index 3d37102b29a..63736787ec5 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.c
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.c
@@ -2187,6 +2187,7 @@ void pdf_finish_file(PDF pdf, int fatal_error) {
int outlines = 0;
int threads = 0;
int names_tree = 0;
+ int prerolled = 0;
size_t xref_offset_width;
int luatexversion = luatex_version;
str_number luatexrevision = get_luatexrevision();
@@ -2215,13 +2216,46 @@ void pdf_finish_file(PDF pdf, int fatal_error) {
check_nonexisting_pages(pdf);
check_nonexisting_destinations(pdf);
}
- /*tex Output fonts definition. */
+ /*tex
+ Output fonts definition.
+ */
+ pdf->gen_tounicode = pdf_gen_tounicode;
+ pdf->omit_cidset = pdf_omit_cidset;
+ pdf->omit_charset = pdf_omit_charset;
+ /*tex
+ The first pass over the list will flag the slots that are
+ used so that we can do a preroll for type 3 fonts.
+ */
for (k = 1; k <= max_font_id(); k++) {
if (font_used(k) && (pdf_font_num(k) < 0)) {
i = -pdf_font_num(k);
for (j = font_bc(k); j <= font_ec(k); j++)
if (quick_char_exists(k, j) && pdf_char_marked(k, j))
pdf_mark_char(i, j);
+ }
+ }
+ k = pdf->head_tab[obj_type_font];
+ while (k != 0) {
+ int f = obj_info(pdf, k);
+ if (do_pdf_preroll_font(pdf, f)) {
+ prerolled = 1;
+ }
+ k = obj_link(pdf, k);
+ }
+ /*tex
+ Just in case the user type 3 font has used fonts, we need to
+ do a second pass. We also collect some additional data here.
+ */
+ for (k = 1; k <= max_font_id(); k++) {
+ if (font_used(k) && (pdf_font_num(k) < 0)) {
+ i = -pdf_font_num(k);
+ if (prerolled) {
+ for (j = font_bc(k); j <= font_ec(k); j++)
+ if (quick_char_exists(k, j) && pdf_char_marked(k, j))
+ pdf_mark_char(i, j);
+ } else {
+ /*tex No need to waste time on checking again. */
+ }
if ((pdf_font_attr(i) == 0) && (pdf_font_attr(k) != 0)) {
set_pdf_font_attr(i, pdf_font_attr(k));
} else if ((pdf_font_attr(k) == 0) && (pdf_font_attr(i) != 0)) {
@@ -2231,9 +2265,6 @@ void pdf_finish_file(PDF pdf, int fatal_error) {
}
}
}
- pdf->gen_tounicode = pdf_gen_tounicode;
- pdf->omit_cidset = pdf_omit_cidset;
- pdf->omit_charset = pdf_omit_charset;
k = pdf->head_tab[obj_type_font];
while (k != 0) {
int f = obj_info(pdf, k);
@@ -2241,6 +2272,9 @@ void pdf_finish_file(PDF pdf, int fatal_error) {
k = obj_link(pdf, k);
}
write_fontstuff(pdf);
+ /*tex
+ We're done with the fonts.
+ */
if (total_pages > 0) {
pdf->last_pages = output_pages_tree(pdf);
/*tex Output outlines. */