diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2015-10-07 02:16:02 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2015-10-07 02:16:02 +0000 |
commit | a021762e6ccc1101fefbac38abb168b69a11f0ca (patch) | |
tree | baf31827b9c7c7af518a3f4aa58ccba0de18b640 | |
parent | 4ca2692153042a0c2f7db8d681e190b867ae2faf (diff) |
web2c/luatexdir: Sync with the upstream trunk.
git-svn-id: svn://tug.org/texlive/trunk@38575 c570f23f-e606-0410-a88d-b1316a301751
51 files changed, 978 insertions, 490 deletions
diff --git a/Build/source/texk/web2c/luatexdir/ChangeLog b/Build/source/texk/web2c/luatexdir/ChangeLog index c6acabbcf6d..393b117e677 100644 --- a/Build/source/texk/web2c/luatexdir/ChangeLog +++ b/Build/source/texk/web2c/luatexdir/ChangeLog @@ -1,3 +1,7 @@ +2015-10-07 Akira Kakuto <kakuto@fuk.kindai.ac.jp> + + * Sync with the upstream trunk. + 2015-10-05 Akira Kakuto <kakuto@fuk.kindai.ac.jp> * Completely sync with the upstream trunk. diff --git a/Build/source/texk/web2c/luatexdir/font/luatexfont.h b/Build/source/texk/web2c/luatexdir/font/luatexfont.h index d9ff3ea89d6..fba411ac774 100644 --- a/Build/source/texk/web2c/luatexdir/font/luatexfont.h +++ b/Build/source/texk/web2c/luatexdir/font/luatexfont.h @@ -174,11 +174,12 @@ void t1_free(void); extern int t1_length1, t1_length2, t1_length3; /* writetype2.c */ -void writetype2(PDF, fd_entry *); +boolean writetype2(PDF, fd_entry *); extern unsigned long cidtogid_obj; pdf_obj *pdf_new_stream(void); void pdf_add_stream(pdf_obj * stream, unsigned char *buf, long len); void pdf_release_obj(pdf_obj * stream); +unsigned long ttc_read_offset(sfnt * sfont, int ttc_idx); /* subfont.c */ void sfd_free(void); diff --git a/Build/source/texk/web2c/luatexdir/font/writefont.w b/Build/source/texk/web2c/luatexdir/font/writefont.w index b5eb8ae711a..bbe2524b40b 100644 --- a/Build/source/texk/web2c/luatexdir/font/writefont.w +++ b/Build/source/texk/web2c/luatexdir/font/writefont.w @@ -428,17 +428,20 @@ static void write_fontfile(PDF pdf, fd_entry * fd) /* by using the regular code for this and assigning indices and tounicodes */ /* to the character blobs, but for the moment we keep the current approach */ if (is_cidkeyed(fd->fm)) { - if (is_opentype(fd->fm)) + if (is_opentype(fd->fm)) { writetype0(pdf, fd); - else if (is_truetype(fd->fm)) - writetype2(pdf, fd); - else if (is_type1(fd->fm)) - writetype1w(pdf, fd); - else - assert(0); + } else if (is_truetype(fd->fm)) { + if (!writetype2(pdf, fd)) { + writetype0(pdf,fd); + fd->fm->type |= F_OTF; fd->fm->type ^= F_TRUETYPE; + } + } else if (is_type1(fd->fm)) + writetype1w(pdf, fd); + else + assert(0); } else { - if (is_type1(fd->fm)) - writet1(pdf, fd); + if (is_type1(fd->fm)) + writet1(pdf, fd); else if (is_truetype(fd->fm)) writettf(pdf, fd); else if (is_opentype(fd->fm)) diff --git a/Build/source/texk/web2c/luatexdir/font/writettf.h b/Build/source/texk/web2c/luatexdir/font/writettf.h index 552148af26b..482c1d192dc 100644 --- a/Build/source/texk/web2c/luatexdir/font/writettf.h +++ b/Build/source/texk/web2c/luatexdir/font/writettf.h @@ -152,6 +152,7 @@ extern dirtab_entry *dir_tab; extern dirtab_entry *ttf_name_lookup(const char *s, boolean required); extern dirtab_entry *ttf_seek_tab(const char *name, TTF_LONG offset); +extern void otc_read_tabdir(int index); extern void ttf_read_tabdir(void); extern void ttf_read_head(void); extern void ttf_read_hhea(void); diff --git a/Build/source/texk/web2c/luatexdir/font/writettf.w b/Build/source/texk/web2c/luatexdir/font/writettf.w index dd87c981b2c..77fef925507 100644 --- a/Build/source/texk/web2c/luatexdir/font/writettf.w +++ b/Build/source/texk/web2c/luatexdir/font/writettf.w @@ -510,9 +510,10 @@ static void ttf_ncopy(PDF pdf, int n) dirtab_entry *ttf_name_lookup(const char *s, boolean required) { dirtab_entry *tab; - for (tab = dir_tab; tab - dir_tab < ntabs; tab++) + for (tab = dir_tab; tab - dir_tab < ntabs; tab++) { if (strncmp(tab->tag, s, 4) == 0) break; + } if (tab - dir_tab == ntabs) { if (required) luatex_fail("can't find table `%s'", s); @@ -836,6 +837,29 @@ static void ttf_read_loca(void) glyph->offset = get_ushort() << 1; } +void otc_read_tabdir(int index) +{ + unsigned long i, num, rem=0; + dirtab_entry *tab; + ttf_skip(TTF_FIXED_SIZE); /* ignore TTCTag 'ttcf' */ + ttf_skip(TTF_ULONG_SIZE); /* ignorethe version number */ + num = get_ulong(); + for (i = 0; i < num; i++) { + if (i==index) rem = get_ulong(); else ttf_skip(TTF_ULONG_SIZE); + } + ttf_skip(rem - TTF_FIXED_SIZE - (num+2)*TTF_ULONG_SIZE); + ttf_skip(TTF_FIXED_SIZE); /* ignore the sfnt number */ + dir_tab = xtalloc(ntabs = get_ushort(), dirtab_entry); + ttf_skip(3 * TTF_USHORT_SIZE); + for (tab = dir_tab; tab - dir_tab < ntabs; tab++) { + for (i = 0; i < 4; i++) + tab->tag[i] = get_char(); + tab->checksum = get_ulong(); + tab->offset = get_ulong(); + tab->length = get_ulong(); + } +} + void ttf_read_tabdir(void) { int i; diff --git a/Build/source/texk/web2c/luatexdir/font/writetype0.w b/Build/source/texk/web2c/luatexdir/font/writetype0.w index b88ee81f702..3f63b02ae12 100644 --- a/Build/source/texk/web2c/luatexdir/font/writetype0.w +++ b/Build/source/texk/web2c/luatexdir/font/writetype0.w @@ -25,20 +25,22 @@ #include "font/writecff.h" @ @c +extern unsigned char *ttf_buffer; void writetype0(PDF pdf, fd_entry * fd) { int callback_id; int file_opened = 0; - long i; + long i = 0; dirtab_entry *tab; cff_font *cff; + sfnt *sfont; dir_tab = NULL; glyph_tab = NULL; fd_cur = fd; /* |fd_cur| is global inside \.{writettf.w} */ assert(fd_cur->fm != NULL); - assert(is_opentype(fd_cur->fm)); + assert(is_opentype(fd_cur->fm) || is_truetype(fd_cur->fm)); assert(is_included(fd_cur->fm)); ttf_curbyte = 0; @@ -46,8 +48,12 @@ void writetype0(PDF pdf, fd_entry * fd) cur_file_name = luatex_find_file(fd_cur->fm->ff_name, find_opentype_file_callback); if (cur_file_name == NULL) { - luatex_fail("cannot find OpenType font file for reading (%s)", - fd_cur->fm->ff_name); + cur_file_name = + luatex_find_file(fd_cur->fm->ff_name, find_truetype_file_callback); + if (cur_file_name == NULL) { + luatex_fail("cannot find OpenType font file for reading (%s)", + fd_cur->fm->ff_name); + } } callback_id = callback_defined(read_opentype_file_callback); if (callback_id > 0) { @@ -69,12 +75,22 @@ void writetype0(PDF pdf, fd_entry * fd) fd_cur->ff_found = true; + sfont = sfnt_open(ttf_buffer, ttf_size); + if (sfont->type == SFNT_TYPE_TTC) + i = ff_get_ttc_index(fd->fm->ff_name, fd->fm->ps_name); + + if (is_subsetted(fd_cur->fm)) { report_start_file(filetype_subset, cur_file_name); } else { report_start_file(filetype_font, cur_file_name); } - ttf_read_tabdir(); + + + if (sfont->type == SFNT_TYPE_TTC) otc_read_tabdir(i); + else ttf_read_tabdir(); + sfnt_close(sfont); + /* read font parameters */ if (ttf_name_lookup("head", false) != NULL) ttf_read_head(); diff --git a/Build/source/texk/web2c/luatexdir/font/writetype2.w b/Build/source/texk/web2c/luatexdir/font/writetype2.w index 20987014752..f218d0f94bd 100644 --- a/Build/source/texk/web2c/luatexdir/font/writetype2.w +++ b/Build/source/texk/web2c/luatexdir/font/writetype2.w @@ -30,7 +30,7 @@ @ forward declaration @c -void make_tt_subset(PDF pdf, fd_entry * fd, unsigned char *buff, int buflen); +boolean make_tt_subset(PDF pdf, fd_entry * fd, unsigned char *buff, int buflen); @ @c unsigned long cidtogid_obj = 0; @@ -134,10 +134,11 @@ void pdf_release_obj(pdf_obj * stream) @ The main function. @c -void writetype2(PDF pdf, fd_entry * fd) +boolean writetype2(PDF pdf, fd_entry * fd) { int callback_id; int file_opened = 0; + boolean ret; glyph_tab = NULL; @@ -178,7 +179,7 @@ void writetype2(PDF pdf, fd_entry * fd) /* here is the real work */ - make_tt_subset(pdf, fd, ttf_buffer, ttf_size); + ret = make_tt_subset(pdf, fd, ttf_buffer, ttf_size); #if 0 xfree (dir_tab); #endif @@ -188,6 +189,7 @@ void writetype2(PDF pdf, fd_entry * fd) else report_stop_file(filetype_font); cur_file_name = NULL; + return ret; } @ PDF viewer applications use following tables (CIDFontType 2) @@ -232,7 +234,7 @@ static struct { }; -static unsigned long ttc_read_offset(sfnt * sfont, int ttc_idx) +unsigned long ttc_read_offset(sfnt * sfont, int ttc_idx) { //ULONG version; unsigned long offset = 0; @@ -255,7 +257,7 @@ static unsigned long ttc_read_offset(sfnt * sfont, int ttc_idx) @ Creating the subset. @c extern int cidset; -void make_tt_subset(PDF pdf, fd_entry * fd, unsigned char *buff, int buflen) +boolean make_tt_subset(PDF pdf, fd_entry * fd, unsigned char *buff, int buflen) { long i, cid; @@ -287,6 +289,12 @@ void make_tt_subset(PDF pdf, fd_entry * fd, unsigned char *buff, int buflen) fprintf(stderr, "Could not parse the ttf directory.\n"); uexit(1); } + + if (sfont->type == SFNT_TYPE_TTC && sfnt_find_table_pos(sfont, "CFF ")) { + sfnt_close(sfont); + return false; + } + if (is_subsetted(fd->fm)) { /* rebuild the glyph tables and create a fresh cidmap */ glyphs = tt_build_init(); @@ -436,5 +444,5 @@ void make_tt_subset(PDF pdf, fd_entry * fd, unsigned char *buff, int buflen) xfree(used_chars); sfnt_close(sfont); - return; + return true; } diff --git a/Build/source/texk/web2c/luatexdir/image/epdf.h b/Build/source/texk/web2c/luatexdir/image/epdf.h index 2c9d5db53e5..1a4cc78c381 100644 --- a/Build/source/texk/web2c/luatexdir/image/epdf.h +++ b/Build/source/texk/web2c/luatexdir/image/epdf.h @@ -124,6 +124,7 @@ extern "C" { extern void read_pdf_info(image_dict *, int, int, img_readtype_e); extern void write_epdf(PDF, image_dict *); extern void unrefPdfDocument(char *); + extern void unrefMemStreamPdfDocument(char *); extern void epdf_free(void); extern void copyReal(PDF pdf, double d); @@ -194,4 +195,13 @@ struct PdfDocument { PdfDocument *refPdfDocument(const char *file_path, file_error_mode fe); +PdfDocument *refMemStreamPdfDocument(char *docstream, unsigned long long streamsize, const char *file_id); + + +#define STREAM_CHECKSUM_SIZE 16 // md5 +#define STRSTREAM_CHECKSUM_SIZE 1+((unsigned int)(log(ULONG_MAX)/log(16))) // djb2 printable digest as hex stream +#define STREAM_FILE_ID_LEN 2048 // 2048 bytes are enough to make a strong almost-unique name +#define STREAM_URI "data:application/pdf," +#define STREAM_URI_LEN 21 // length of "data:application/pdf," without final '\0' + #endif /* EPDF_H */ diff --git a/Build/source/texk/web2c/luatexdir/image/image.h b/Build/source/texk/web2c/luatexdir/image/image.h index 32ead6a0f65..5a9adfdc9bb 100644 --- a/Build/source/texk/web2c/luatexdir/image/image.h +++ b/Build/source/texk/web2c/luatexdir/image/image.h @@ -70,8 +70,9 @@ typedef enum { DICT_NEW, /* fresh dictionary */ DICT_WRITTEN /* image dict written to file */ } dict_state; + typedef enum { IMG_TYPE_NONE, IMG_TYPE_PDF, IMG_TYPE_PNG, IMG_TYPE_JPG, - IMG_TYPE_JP2, IMG_TYPE_JBIG2, IMG_TYPE_PDFSTREAM, IMG_TYPE_SENTINEL + IMG_TYPE_JP2, IMG_TYPE_JBIG2, IMG_TYPE_PDFSTREAM, IMG_TYPE_PDFMEMSTREAM, IMG_TYPE_SENTINEL } imgtype_e; typedef enum { IMG_KEEPOPEN, IMG_CLOSEINBETWEEN } img_readtype_e; @@ -183,7 +184,7 @@ typedef struct { # define epdf_orig_x(a) img_xorig(idict_array[a]) # define epdf_orig_y(a) img_yorig(idict_array[a]) -# define is_pdf_image(a) (img_type(idict_array[a]) == IMG_TYPE_PDF) +# define is_pdf_image(a) ((img_type(idict_array[a]) == IMG_TYPE_PDF) || (img_type(idict_array[a]) == IMG_TYPE_PDFMEMSTREAM)) # define is_png_image(a) (img_type(idict_array[a]) == IMG_TYPE_PNG) # define img_is_refered(N) (img_index(N) != -1) diff --git a/Build/source/texk/web2c/luatexdir/image/pdftoepdf.h b/Build/source/texk/web2c/luatexdir/image/pdftoepdf.h index 4e2dc36717c..203f85c5c31 100644 --- a/Build/source/texk/web2c/luatexdir/image/pdftoepdf.h +++ b/Build/source/texk/web2c/luatexdir/image/pdftoepdf.h @@ -26,6 +26,7 @@ void read_pdf_info(image_dict *, int, int, img_readtype_e); void unrefPdfDocument(char *); +void unrefMemStreamPdfDocument(char *); void write_epdf(PDF, image_dict *); void epdf_check_mem(void); void copyReal(PDF pdf, double d); diff --git a/Build/source/texk/web2c/luatexdir/image/pdftoepdf.w b/Build/source/texk/web2c/luatexdir/image/pdftoepdf.w index b01a10bb8c1..cacaea11389 100644 --- a/Build/source/texk/web2c/luatexdir/image/pdftoepdf.w +++ b/Build/source/texk/web2c/luatexdir/image/pdftoepdf.w @@ -27,7 +27,9 @@ #include "image/epdf.h" // This file is mostly C and not very much C++; it's just used to interface -// the functions of xpdf, which happens to be written in C++. +// the functions of poppler, which happens to be written in C++. + +extern void md5(Guchar *msg, int msgLen, Guchar *digest); static GBool isInit = gFalse; @@ -89,6 +91,27 @@ static char *get_file_checksum(const char *a, file_error_mode fe) return ck; } + +static char *get_stream_checksum (const char *str, unsigned long long str_size){ + /* http://www.cse.yorku.ca/~oz/hash.html */ + /* djb2 */ + unsigned long hash ; + char *ck = NULL; + unsigned int i; + hash = 5381; + ck = (char *) malloc(STRSTREAM_CHECKSUM_SIZE+1); + if (ck == NULL) + luatex_fail("PDF inclusion: out of memory while processing a memstream"); + for(i=0; i<(unsigned int)(str_size); i++) { + hash = ((hash << 5) + hash) + str[i]; /* hash * 33 + str[i] */ + } + snprintf(ck,STRSTREAM_CHECKSUM_SIZE+1,"%lx",hash); + ck[STRSTREAM_CHECKSUM_SIZE]='\0'; + return ck; +} + + + // Returns pointer to PdfDocument structure for PDF file. // Creates a new PdfDocument structure if it doesn't exist yet. // When fe = FE_RETURN_NULL, the function returns NULL in error case. @@ -144,7 +167,7 @@ PdfDocument *refPdfDocument(const char *file_path, file_error_mode fe) if (!doc->isOk() || !doc->okToPrint()) { switch (fe) { case FE_FAIL: - luatex_fail("xpdf: reading PDF image failed"); + luatex_fail("PDF inclusion: reading PDF image failed"); break; case FE_RETURN_NULL: delete doc; @@ -179,6 +202,92 @@ PdfDocument *refPdfDocument(const char *file_path, file_error_mode fe) return pdf_doc; } + + +// Returns pointer to PdfDocument structure for a PDF stream in memory +// of streamsize dimension +// As before, creates a new PdfDocument structure if it doesn't exist yet +// with file_path = file_id + +PdfDocument *refMemStreamPdfDocument(char *docstream, unsigned long long streamsize,const char *file_id) +{ + char *checksum; + char *file_path; + PdfDocument *pdf_doc; + PDFDoc *doc = NULL; + Object obj; + MemStream *docmemstream = NULL; + /*int new_flag = 0;*/ + size_t cnt = 0; + + checksum = get_stream_checksum(docstream, streamsize); + assert(checksum != NULL); + cnt = strlen(file_id); + assert(cnt>0 && cnt <STREAM_FILE_ID_LEN); + file_path = (char *) malloc(cnt+STREAM_URI_LEN+STRSTREAM_CHECKSUM_SIZE+1); // 1 for '\0' + assert(file_path != NULL); + strcpy(file_path,STREAM_URI); + strcat(file_path,file_id); + strcat(file_path,checksum); + file_path[cnt+STREAM_URI_LEN+STRSTREAM_CHECKSUM_SIZE]='\0'; + if ((pdf_doc = findPdfDocument(file_path)) == NULL) { +#ifdef DEBUG + fprintf(stderr, "\nDEBUG: New MemStreamPdfDocument %s\n", file_path); +#endif + /*new_flag = 1;*/ + pdf_doc = new PdfDocument; + pdf_doc->file_path = file_path; + pdf_doc->checksum = checksum; + pdf_doc->doc = NULL; + pdf_doc->inObjList = NULL; + pdf_doc->ObjMapTree = NULL; + pdf_doc->occurences = 0; // 0 = unreferenced + pdf_doc->pc = 0; + } else { +#ifdef DEBUG + fprintf(stderr, "\nDEBUG: Found MemStreamPdfDocument %s (%d)\n", + pdf_doc->file_path, pdf_doc->occurences); +#endif + assert(pdf_doc->checksum != NULL); + // As is now, checksum is in file_path, so this check is should be useless. + if (strncmp(pdf_doc->checksum, checksum, STRSTREAM_CHECKSUM_SIZE) != 0) { + luatex_fail("PDF inclusion: stream has changed '%s'", file_path); + } + free(file_path); + free(checksum); + } + assert(pdf_doc != NULL); + if (pdf_doc->doc == NULL) { +#ifdef DEBUG + fprintf(stderr, "\nDEBUG: New PDFDoc %s (%d)\n", + pdf_doc->file_path, pdf_doc->occurences); +#endif + docmemstream = new MemStream( docstream,0,streamsize, obj.initNull() ); + doc = new PDFDoc(docmemstream); // takes ownership of docmemstream + pdf_doc->pc++; + + if (!doc->isOk() || !doc->okToPrint()) { + luatex_fail("poppler: reading PDF Stream failed"); + } + pdf_doc->doc = doc; + } + // PDF file could be opened without problems, checksum ok. + if (PdfDocumentTree == NULL) + PdfDocumentTree = avl_create(CompPdfDocument, NULL, &avl_xallocator); + if ((PdfDocument *) avl_find(PdfDocumentTree, pdf_doc) == NULL) { + void **aa = avl_probe(PdfDocumentTree, pdf_doc); + assert(aa != NULL); + } + pdf_doc->occurences++; +#ifdef DEBUG + fprintf(stderr, "\nDEBUG: Incrementing %s (%d)\n", + pdf_doc->file_path, pdf_doc->occurences); +#endif + return pdf_doc; +} + + + //********************************************************************** // AVL sort ObjMap into ObjMapTree by object number and generation @@ -433,7 +542,7 @@ static void copyObject(PDF pdf, PdfDocument * pdf_doc, Object * obj) obj->getTypeName()); break; default: - assert(0); // xpdf doesn't have any other types + assert(0); // poppler doesn't have any other types } } @@ -507,16 +616,24 @@ read_pdf_info(image_dict * idict, int minor_pdf_version_wanted, int pdf_major_version_found, pdf_minor_version_found; float xsize, ysize, xorig, yorig; assert(idict != NULL); - assert(img_type(idict) == IMG_TYPE_PDF); + assert((img_type(idict) == IMG_TYPE_PDF) || (img_type(idict) == IMG_TYPE_PDFMEMSTREAM)); assert(readtype == IMG_CLOSEINBETWEEN); // only this is implemented // initialize if (isInit == gFalse) { - globalParams = new GlobalParams(); - globalParams->setErrQuiet(gFalse); - isInit = gTrue; + if (!(globalParams)) // globalParams could be already created + globalParams = new GlobalParams(); + globalParams->setErrQuiet(gFalse); + isInit = gTrue; } // open PDF file - pdf_doc = refPdfDocument(img_filepath(idict), FE_FAIL); + if (img_type(idict) == IMG_TYPE_PDF) + pdf_doc = refPdfDocument(img_filepath(idict), FE_FAIL); + else if (img_type(idict) == IMG_TYPE_PDFMEMSTREAM) { + pdf_doc = findPdfDocument(img_filepath(idict)) ; + assert(pdf_doc != NULL); + pdf_doc->occurences++; + } else + luatex_fail("PDF inclusion: unknown document (1)"); doc = pdf_doc->doc; catalog = doc->getCatalog(); // check PDF version @@ -638,7 +755,14 @@ void write_epdf(PDF pdf, image_dict * idict) assert(idict != NULL); // open PDF file - pdf_doc = refPdfDocument(img_filepath(idict), FE_FAIL); + if (img_type(idict) == IMG_TYPE_PDF) + pdf_doc = refPdfDocument(img_filepath(idict), FE_FAIL); + else if (img_type(idict) == IMG_TYPE_PDFMEMSTREAM) { + pdf_doc = findPdfDocument(img_filepath(idict)) ; + assert(pdf_doc != NULL); + pdf_doc->occurences++; + } else + luatex_fail("PDF inclusion: unknown document (2)"); doc = pdf_doc->doc; catalog = doc->getCatalog(); page = catalog->getPage(img_pagenum(idict)); @@ -855,6 +979,17 @@ void unrefPdfDocument(char *file_path) } } + + +// For completeness, but it isn't currently used +// (unreferencing is done by mean of file_path) + +void unrefMemStreamPdfDocument(char *file_id) +{ + (void) unrefPdfDocument(file_id); + +} + // Called when PDF embedding system is finalized. // Now deallocate all remaining PdfDocuments. diff --git a/Build/source/texk/web2c/luatexdir/image/writeimg.w b/Build/source/texk/web2c/luatexdir/image/writeimg.w index 3f6da1a4bee..561efd514c0 100644 --- a/Build/source/texk/web2c/luatexdir/image/writeimg.w +++ b/Build/source/texk/web2c/luatexdir/image/writeimg.w @@ -124,18 +124,41 @@ #define HEADER_JP2 "\x6A\x50\x20\x20" #define HEADER_PDF "%PDF-1." #define MAX_HEADER (sizeof(HEADER_PNG)-1) +#define HEADER_PDF_MEMSTREAM "data:application/pdf," /* see epdf.h */ +#define LEN_PDF_MEMSTREAM 21 /* see epdf.h */ + static void check_type_by_header(image_dict * idict) { int i; FILE *file = NULL; char header[MAX_HEADER]; + char prefix[LEN_PDF_MEMSTREAM+1]; assert(idict != NULL); if (img_type(idict) != IMG_TYPE_NONE) /* nothing to do */ return; + /* read the header */ - file = xfopen(img_filepath(idict), FOPEN_RBIN_MODE); + /* Like */ + /* file = xfopen(img_filepath(idict), FOPEN_RBIN_MODE);*/ + /* but we also check for a memstream object */ + assert(img_filepath(idict) && FOPEN_RBIN_MODE); + file = fopen(img_filepath(idict), FOPEN_RBIN_MODE); + if (file == NULL) { + /* check the prefix of img_filepath(idict) */ + for (i = 0; (unsigned) i < LEN_PDF_MEMSTREAM; i++) { + prefix[i] = (char) (img_filepath(idict)[i]); + } + prefix[LEN_PDF_MEMSTREAM]='\0'; + if (strncmp(prefix, HEADER_PDF_MEMSTREAM, LEN_PDF_MEMSTREAM) == 0) { + img_type(idict) = IMG_TYPE_PDFMEMSTREAM; + return; + } else { + FATAL_PERROR(img_filepath(idict)); + } + } + /* a valid file, but perhaps unsupported */ for (i = 0; (unsigned) i < MAX_HEADER; i++) { header[i] = (char) xgetc(file); if (feof(file)) @@ -252,6 +275,7 @@ void free_image_dict(image_dict * p) /* called from limglib.c */ assert(img_state(p) < DICT_REFERED); switch (img_type(p)) { + case IMG_TYPE_PDFMEMSTREAM: case IMG_TYPE_PDF: unrefPdfDocument(img_filepath(p)); break; @@ -310,6 +334,7 @@ void read_img(PDF pdf, check_type_by_extension(idict); /* read image */ switch (img_type(idict)) { + case IMG_TYPE_PDFMEMSTREAM: case IMG_TYPE_PDF: assert(pdf != NULL); /* TODO! */ read_pdf_info(idict, minor_version, inclusion_errorlevel, @@ -523,7 +548,7 @@ scaled_whd scale_img(image_dict * idict, scaled_whd alt_rule, int transform) scaled_whd nat; /* natural size corresponding to image resolution */ int default_res; assert(idict != NULL); - if ((img_type(idict) == IMG_TYPE_PDF + if ((img_type(idict) == IMG_TYPE_PDF || img_type(idict) == IMG_TYPE_PDFMEMSTREAM || img_type(idict) == IMG_TYPE_PDFSTREAM) && img_is_bbox(idict)) { x = img_xsize(idict) = img_bbox(idict)[2] - img_bbox(idict)[0]; /* dimensions from image.bbox */ y = img_ysize(idict) = img_bbox(idict)[3] - img_bbox(idict)[1]; @@ -551,7 +576,7 @@ scaled_whd scale_img(image_dict * idict, scaled_whd alt_rule, int transform) yr = tmp; } nat.dp = 0; /* always for images */ - if (img_type(idict) == IMG_TYPE_PDF + if (img_type(idict) == IMG_TYPE_PDF || img_type(idict) == IMG_TYPE_PDFMEMSTREAM || img_type(idict) == IMG_TYPE_PDFSTREAM) { nat.wd = x; nat.ht = y; @@ -591,6 +616,7 @@ void write_img(PDF pdf, image_dict * idict) case IMG_TYPE_JBIG2: write_jbig2(pdf, idict); break; + case IMG_TYPE_PDFMEMSTREAM: case IMG_TYPE_PDF: write_epdf(pdf, idict); break; @@ -677,7 +703,7 @@ void pdf_dict_add_img_filename(PDF pdf, image_dict * idict) char s[21], *p; assert(idict != NULL); /* for now PTEX.FileName only for PDF, but prepared for JPG, PNG, ... */ - if (img_type(idict) != IMG_TYPE_PDF) + if ((img_type(idict) != IMG_TYPE_PDF) || (img_type(idict) != IMG_TYPE_PDFMEMSTREAM)) return; if (img_visiblefilename(idict) != NULL) { if (strlen(img_visiblefilename(idict)) == 0) @@ -768,7 +794,7 @@ void dumpimagemeta(void) /* the |image_struct| is not dumped at all, except for a few variables that are needed to restore the contents */ - if (img_type(idict) == IMG_TYPE_PDF) { + if ((img_type(idict) == IMG_TYPE_PDF)|| (img_type(idict) == IMG_TYPE_PDFMEMSTREAM)) { dumpinteger(img_pagebox(idict)); dumpinteger(img_pagenum(idict)); } else if (img_type(idict) == IMG_TYPE_JBIG2) { @@ -808,6 +834,7 @@ void undumpimagemeta(PDF pdf, int pdfversion, int pdfinclusionerrorlevel) undumpinteger(img_colorspace(idict)); switch (img_type(idict)) { + case IMG_TYPE_PDFMEMSTREAM: case IMG_TYPE_PDF: undumpinteger(img_pagebox(idict)); undumpinteger(img_pagenum(idict)); diff --git a/Build/source/texk/web2c/luatexdir/lang/texlang.h b/Build/source/texk/web2c/luatexdir/lang/texlang.h index 0fdff82d81a..9a8534b3996 100644 --- a/Build/source/texk/web2c/luatexdir/lang/texlang.h +++ b/Build/source/texk/web2c/luatexdir/lang/texlang.h @@ -1,5 +1,5 @@ /* texlang.h - + Copyright 2009 Taco Hoekwater <taco@luatex.org> This file is part of LuaTeX. @@ -38,6 +38,7 @@ struct tex_language { int post_hyphen_char; int pre_exhyphen_char; int post_exhyphen_char; + int hyphenation_min; }; # define MAX_WORD_LEN 65536 /* in chars */ @@ -64,6 +65,10 @@ extern void set_pre_exhyphen_char(int lan, int val); extern void set_post_exhyphen_char(int lan, int val); extern int get_pre_exhyphen_char(int lan); extern int get_post_exhyphen_char(int lan); + +extern void set_hyphenation_min(int lan, int val); +extern int get_hyphenation_min(int lan); + extern halfword compound_word_break(halfword t, int clang); extern void dump_language_data(void); @@ -76,6 +81,7 @@ extern void new_pre_hyphen_char(void); extern void new_post_hyphen_char(void); extern void new_pre_exhyphen_char(void); extern void new_post_exhyphen_char(void); +extern void new_hyphenation_min(void); #endif diff --git a/Build/source/texk/web2c/luatexdir/lang/texlang.w b/Build/source/texk/web2c/luatexdir/lang/texlang.w index 2053220d2c4..438cf794137 100644 --- a/Build/source/texk/web2c/luatexdir/lang/texlang.w +++ b/Build/source/texk/web2c/luatexdir/lang/texlang.w @@ -61,6 +61,7 @@ struct tex_language *new_language(int n) lang->post_hyphen_char = 0; lang->pre_exhyphen_char = 0; lang->post_exhyphen_char = 0; + lang->hyphenation_min = -1; return lang; } else { return NULL; @@ -144,6 +145,22 @@ int get_post_exhyphen_char(int n) return (int) l->post_exhyphen_char; } + +void set_hyphenation_min(int n, int v) +{ + struct tex_language *l = get_language((int) n); + if (l != NULL) + l->hyphenation_min = (int) v; +} + +int get_hyphenation_min(int n) +{ + struct tex_language *l = get_language((int) n); + if (l == NULL) + return -1; + return (int) l->hyphenation_min; +} + @ @c void load_patterns(struct tex_language *lang, const unsigned char *buff) { @@ -314,11 +331,12 @@ void load_tex_hyphenation(int curlang, halfword head) @c halfword insert_discretionary(halfword t, halfword pre, halfword post, - halfword replace) + halfword replace, int penalty) { halfword g, n; int f; n = new_node(disc_node, syllable_disc); + disc_penalty(n) = penalty; try_couple_nodes(n, vlink(t)); couple_nodes(t, n); if (replace != null) @@ -364,6 +382,7 @@ halfword insert_syllable_discretionary(halfword t, lang_variables * lan) { halfword g, n; n = new_node(disc_node, syllable_disc); + disc_penalty(n) = int_par(hyphen_penalty_code); couple_nodes(n, vlink(t)); couple_nodes(t, n); delete_attribute_ref(node_attr(n)); @@ -409,7 +428,7 @@ halfword insert_word_discretionary(halfword t, lang_variables * lan) pre = insert_character(null, lan->pre_exhyphen_char); if (lan->post_exhyphen_char > 0) pos = insert_character(null, lan->post_exhyphen_char); - return insert_discretionary(t, pre, pos, null); + return insert_discretionary(t, pre, pos, null,int_par(ex_hyphen_penalty_code)); } @ @c @@ -429,7 +448,7 @@ halfword insert_complex_discretionary(halfword t, lang_variables * lan, halfword replace) { (void) lan; - return insert_discretionary(t, pre, pos, replace); + return insert_discretionary(t, pre, pos, replace,int_par(hyphen_penalty_code)); } @@ -617,7 +636,7 @@ static void do_exception(halfword wordstart, halfword r, char *replacement) try_couple_nodes(t, vlink(q)); vlink(q) = null; } - t = insert_discretionary(t, gg, hh, replace); + t = insert_discretionary(t, gg, hh, replace,int_par(hyphen_penalty_code)); t = vlink(t); /* skip the new disc */ } else { t = vlink(t); @@ -732,7 +751,7 @@ static halfword find_next_wordstart(halfword r) /* -- or --- ligature in which case we can in a worse case usage get bad */ /* node lists later on due to messed up ligature building as these dashes */ /* ligatures in base fonts. This is a side effect of the separating the */ - /* hyphenation, ligaturing and kerning steps. A test is cmr with ------. */ + /* hyphenation, ligaturing and kerning steps. A test is cmr with ------. */ t = vlink(r) ; if ((start_ok > 0) && (t!=null) && (type(t) == glyph_node) && (character(t) != ex_hyphen_char)) { t = compound_word_break(r, char_lang(r)); @@ -818,7 +837,7 @@ void hnj_hyphenation(halfword head, halfword tail) couple_nodes(tail, s); while (r != null) { /* could be while(1), but let's be paranoid */ - int clang, lhmin, rhmin; + int clang, lhmin, rhmin, hmin; halfword hyf_font; halfword end_word = r; wordstart = r; @@ -829,6 +848,7 @@ void hnj_hyphenation(halfword head, halfword tail) clang = char_lang(wordstart); lhmin = char_lhmin(wordstart); rhmin = char_rhmin(wordstart); + hmin = get_hyphenation_min(clang); langdata.pre_hyphen_char = get_pre_hyphen_char(clang); langdata.post_hyphen_char = get_post_hyphen_char(clang); while (r != null && type(r) == glyph_node && is_simple_character(r) && clang == char_lang(r) && @@ -842,7 +862,7 @@ void hnj_hyphenation(halfword head, halfword tail) end_word = r; r = vlink(r); } - if (valid_wordend(r) && wordlen >= lhmin + rhmin + if (valid_wordend(r) && wordlen >= lhmin + rhmin && (hmin <= 0 || wordlen >= hmin) && (hyf_font != 0) && clang >=0 && (lang = tex_languages[clang]) != NULL) { *hy = 0; if (lang->exceptions != 0 && @@ -963,6 +983,7 @@ static void dump_one_language(int i) dump_int(lang->post_hyphen_char); dump_int(lang->pre_exhyphen_char); dump_int(lang->post_exhyphen_char); + dump_int(lang->hyphenation_min); if (lang->patterns != NULL) { s = (char *) hnj_serialize(lang->patterns); } @@ -1010,6 +1031,8 @@ static void undump_one_language(int i) lang->pre_exhyphen_char = x; undump_int(x); lang->post_exhyphen_char = x; + undump_int(x); + lang->hyphenation_min = x; /* patterns */ undump_int(x); if (x > 0) { @@ -1102,3 +1125,11 @@ void new_post_exhyphen_char(void) scan_int(); set_post_exhyphen_char(int_par(language_code), cur_val); } + + +void new_hyphenation_min(void) +{ + scan_optional_equals(); + scan_int(); + set_hyphenation_min(int_par(language_code), cur_val); +} diff --git a/Build/source/texk/web2c/luatexdir/lua/lepdflib.cc b/Build/source/texk/web2c/luatexdir/lua/lepdflib.cc index b05e44a4d6b..1f2b5026154 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lepdflib.cc +++ b/Build/source/texk/web2c/luatexdir/lua/lepdflib.cc @@ -129,7 +129,8 @@ static int l_open_PDFDoc(lua_State * L) if (d == NULL) lua_pushnil(L); else { - globalParams = new GlobalParams(); + if (!(globalParams)) // globalParams could be already created + globalParams = new GlobalParams(); uout = new_PDFDoc_userdata(L); uout->d = d; uout->atype = ALLOC_LEPDF; @@ -139,6 +140,59 @@ static int l_open_PDFDoc(lua_State * L) return 1; // doc path } +static int l_open_MemStreamPDFDoc(lua_State * L) +{ + const char *docstream=NULL; + const char *file_id; + unsigned long long stream_size; + udstruct *uout; + PdfDocument *d; + switch (lua_type(L, 1)) { + case LUA_TSTRING: + docstream = luaL_checkstring(L, 1); // stream as Lua string + break; + case LUA_TLIGHTUSERDATA: + docstream = (const char *) lua_touserdata(L, 1); // stream as sequence of bytes + break; + default: + luaL_error(L, "bad argument: string or lightuserdata expected"); + } + if (docstream==NULL) + luaL_error(L, "bad document"); + stream_size = (unsigned long long) luaL_checkint(L, 2);// size of the stream + file_id = luaL_checkstring(L, 3); // a symbolic name for this stream, mandatory + if (file_id == NULL) + lua_pushnil(L); + if (strlen(file_id) >STREAM_FILE_ID_LEN ) // a limit to the length of the string + luaL_error(L, "PDFDoc has a too long id"); + d = refMemStreamPdfDocument((char *)docstream, stream_size, file_id); + if (d == NULL) { + lua_pushnil(L); + lua_pushnil(L); + lua_pushnil(L); + } + else if (d->file_path == NULL ) { + lua_pushnil(L); + lua_pushnil(L); + lua_pushnil(L); + } + else { + if (!(globalParams)) // globalParams could be already created + globalParams = new GlobalParams(); + uout = new_PDFDoc_userdata(L); + uout->d = d; + uout->atype = ALLOC_LEPDF; + uout->pc = d->pc; + uout->pd = d; + lua_pushstring(L,d->file_path); + lua_pushstring(L,STREAM_URI); + } + return 3; // stream, stream_id, stream_uri +} + + + + static int l_new_Array(lua_State * L) { udstruct *uxref, *uout; @@ -361,6 +415,7 @@ static int l_new_PDFRectangle(lua_State * L) static const struct luaL_Reg epdflib_f[] = { {"open", l_open_PDFDoc}, + {"openMemStream", l_open_MemStreamPDFDoc}, {"Array", l_new_Array}, {"Attribute", l_new_Attribute}, {"StructElement_Type", l_StructElement_Type}, diff --git a/Build/source/texk/web2c/luatexdir/lua/limglib.c b/Build/source/texk/web2c/luatexdir/lua/limglib.c index dcb7ea1534d..127faede0c7 100644 --- a/Build/source/texk/web2c/luatexdir/lua/limglib.c +++ b/Build/source/texk/web2c/luatexdir/lua/limglib.c @@ -94,9 +94,9 @@ static const parm_struct img_parms[] = { {NULL, P__SENTINEL} }; -#define imgtype_max 6 +#define imgtype_max 7 const char *imgtype_s[] = - { "none", "pdf", "png", "jpg", "jp2", "jbig2", "stream", NULL }; + { "none", "pdf", "png", "jpg", "jp2", "jbig2", "stream", "memstream",NULL }; #define pagebox_max 5 const char *pdfboxspec_s[] = diff --git a/Build/source/texk/web2c/luatexdir/lua/llanglib.c b/Build/source/texk/web2c/luatexdir/lua/llanglib.c index 771f10219d3..616c0713a18 100644 --- a/Build/source/texk/web2c/luatexdir/lua/llanglib.c +++ b/Build/source/texk/web2c/luatexdir/lua/llanglib.c @@ -1,5 +1,5 @@ /* llanglib.c - + Copyright 2006-2008 Taco Hoekwater <taco@luatex.org> This file is part of LuaTeX. @@ -177,6 +177,23 @@ static int lang_post_exhyphen_char(lua_State * L) } +static int lang_hyphenation_min(lua_State * L) +{ + struct tex_language **lang_ptr; + lang_ptr = check_islang(L, 1); + if (lua_gettop(L) != 1) { + if (!lua_isnumber(L, 2)) { + return luaL_error(L, + "lang.hyphenationmin(): argument should be a number"); + } + (*lang_ptr)->hyphenation_min=(int)lua_tonumber(L, 2); + return 0; + } else { + lua_pushnumber(L, (*lang_ptr)->hyphenation_min); + return 1; + } +} + static int lang_clear_hyphenation(lua_State * L) { struct tex_language **lang_ptr; @@ -226,6 +243,7 @@ static const struct luaL_Reg langlib_d[] = { {"posthyphenchar", lang_post_hyphen_char}, {"preexhyphenchar", lang_pre_exhyphen_char}, {"postexhyphenchar", lang_post_exhyphen_char}, + {"hyphenationmin", lang_hyphenation_min}, {"id", lang_id}, /* *INDENT-ON* */ {NULL, NULL} /* sentinel */ @@ -242,6 +260,7 @@ static const struct luaL_Reg langlib[] = { {"posthyphenchar", lang_post_hyphen_char}, {"preexhyphenchar", lang_pre_exhyphen_char}, {"postexhyphenchar", lang_post_exhyphen_char}, + {"hyphenationmin", lang_hyphenation_min}, {"id", lang_id}, {"clean", do_lang_clean}, {"hyphenate", do_lang_hyphenate}, diff --git a/Build/source/texk/web2c/luatexdir/lua/lnodelib.c b/Build/source/texk/web2c/luatexdir/lua/lnodelib.c index 3e8830f793c..215297b3be1 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lnodelib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lnodelib.c @@ -74,8 +74,6 @@ a speedup on these functions is not representative for a normal run, where much more happens. - maybe : setnext setprev setfont setchar (only makes sense for some scripts) - todo : check and optimize the direct function when possible todo : once the direct ones are proven we can redefine some of the less @@ -91,6 +89,11 @@ Todo: as a prelude to lua 5.3 we should use integer instead of number when possible. A boring job. We can use the direct variants for testing this. + Remark: when a direct node is set, and an invalid one is passed (or nil) we + normally get zero and that is a predefined glue, so we get a message about + assigning to a glue which is fine. What we should do some day is make node + zero a dummy so that null then can be used as test. + Hans Hagen, Luigi Scarso (2011-2013) */ @@ -214,7 +217,7 @@ /* } */ -#define nodelib_setattr(L, s, n) reassign_attribute(n,nodelib_getlist(L,s)) +#define nodelib_setattr(L, s, n) reassign_attribute(n,nodelib_getlist(L,s)) #define nodelib_gettoks(L,a) tokenlist_from_lua(L) @@ -620,6 +623,8 @@ static int lua_nodelib_getfont(lua_State * L) /* node.direct.getfont */ +/* + static int lua_nodelib_direct_getfont(lua_State * L) { halfword n; @@ -632,10 +637,9 @@ static int lua_nodelib_direct_getfont(lua_State * L) return 1; } +*/ -/* node.direct.getfont */ -/* a new one, waiting some patched from HH -static int lua_nodelib_direct_getfont(lua_State * L) +static int lua_nodelib_direct_getfont(lua_State * L) /* family_font is not yet in manual, what does arg 2 do */ { halfword n, t; n = (halfword) lua_tonumber(L, 1); @@ -653,9 +657,6 @@ static int lua_nodelib_direct_getfont(lua_State * L) } return 1; } -*/ - - /* node.getchar */ @@ -708,6 +709,33 @@ static int lua_nodelib_direct_getcharacter(lua_State * L) return 1; } +/* node.getdisc */ + + +static int lua_nodelib_direct_getdiscretionary(lua_State * L) +{ + halfword n; + n = (halfword) lua_tonumber(L, 1); + if (n != null) { + if (type(n) == disc_node) { + nodelib_pushdirect_or_nil(vlink(pre_break(n))); + nodelib_pushdirect_or_nil(vlink(post_break(n))); + nodelib_pushdirect_or_nil(vlink(no_break(n))); + if (lua_isboolean(L, 2)) { + if (lua_toboolean(L, 2)) { + nodelib_pushdirect_or_nil(tlink(pre_break(n))); + nodelib_pushdirect_or_nil(tlink(post_break(n))); + nodelib_pushdirect_or_nil(tlink(no_break(n))); + return 6; + } + } + return 3; + } + } + lua_pushnil(L); + return 1; +} + /* node.getlist */ static int lua_nodelib_getlist(lua_State * L) @@ -898,6 +926,22 @@ static int lua_nodelib_direct_getprev(lua_State * L) return 1; } +/* node.direct.getboth */ + +static int lua_nodelib_direct_getboth(lua_State * L) +{ + halfword p; + p = (halfword) lua_tonumber(L, 1); + if (p == null) { + lua_pushnil(L); + lua_pushnil(L); + } else { + nodelib_pushdirect_or_nil(alink(p)); + nodelib_pushdirect_or_nil(vlink(p)); + } + return 2; +} + /* node.subtype */ static int lua_nodelib_subtype(lua_State * L) @@ -3925,7 +3969,7 @@ static void lua_nodelib_do_tostring(lua_State * L, halfword n, const char *tag) if ((alink(n) != null) && (type(n) != attribute_node)) snprintf(a, 7, "%6d", (int) alink(n)); - if (vlink(n) != null) + if (vlink(n) != null) snprintf(v, 7, "%6d", (int) vlink(n)); snprintf(msg, 255, "<%s %s < %6d > %s : %s %d>", tag, a, (int) n, v, node_data[type(n)].name, subtype(n)); lua_pushstring(L, msg); @@ -4701,7 +4745,7 @@ static int lua_nodelib_setfield_whatsit(lua_State * L, int n, const char *s) } else { return nodelib_cantset(L, n, s); } - } else if ((t == pdf_end_link_node) || (t == pdf_end_thread_node) || (t == pdf_save_pos_node) || + } else if ((t == pdf_end_link_node) || (t == pdf_end_thread_node) || (t == save_pos_node) || (t == pdf_save_node) || (t == pdf_restore_node) || (t == cancel_boundary_node)) { return nodelib_cantset(L, n, s); } else { @@ -5447,7 +5491,7 @@ static int lua_nodelib_direct_setfield_whatsit(lua_State * L, int n, const char } else { return nodelib_cantset(L, n, s); } - } else if ((t == pdf_end_link_node) || (t == pdf_end_thread_node) || (t == pdf_save_pos_node) || + } else if ((t == pdf_end_link_node) || (t == pdf_end_thread_node) || (t == save_pos_node) || (t == pdf_save_node) || (t == pdf_restore_node) || (t == cancel_boundary_node)) { return nodelib_cantset(L, n, s); } else { @@ -5456,6 +5500,136 @@ static int lua_nodelib_direct_setfield_whatsit(lua_State * L, int n, const char return 0; } +static int lua_nodelib_direct_setcharacter(lua_State * L) +{ + halfword n; + n = (halfword ) lua_tonumber(L, 1); + if (n) { + if ((type(n) == glyph_node) && (lua_type(L, 2) == LUA_TNUMBER)) { + character(n) = (halfword) lua_tointeger(L, 2); + } + } + return 0; +} + +static int lua_nodelib_direct_setnext(lua_State * L) +{ + halfword n; + n = (halfword ) lua_tonumber(L, 1); + if (n) { + if (lua_type(L, 2) == LUA_TNUMBER) { + vlink(n) = (halfword) lua_tointeger(L, 2); + } else { + vlink(n) = null; + } + } + return 0; +} + +static int lua_nodelib_direct_setprev(lua_State * L) +{ + halfword n; + n = (halfword ) lua_tonumber(L, 1); + if (n) { + if (lua_type(L, 2) == LUA_TNUMBER) { + alink(n) = (halfword) lua_tointeger(L, 2); + } else { + alink(n) = null; + } + } + return 0; +} + +static int lua_nodelib_direct_setboth(lua_State * L) +{ + halfword n; + n = (halfword ) lua_tonumber(L, 1); + if (n) { + if (lua_type(L, 2) == LUA_TNUMBER) { + alink(n) = (halfword) lua_tointeger(L, 2); + } else { + alink(n) = null; + } + if (lua_type(L, 3) == LUA_TNUMBER) { + vlink(n) = (halfword) lua_tointeger(L, 3); + } else { + vlink(n) = null; + } + } + return 0; +} + +static int lua_nodelib_direct_setlink(lua_State * L) +{ + halfword a, b; + if (lua_type(L, 1) == LUA_TNUMBER) { + a = (halfword ) lua_tonumber(L, 1); + if (lua_type(L, 2) == LUA_TNUMBER) { + b = (halfword ) lua_tonumber(L, 2); + vlink(a) = b; + alink(b) = a; + } else { + vlink(a) = null; + } + } else if (lua_type(L, 2) == LUA_TNUMBER) { + b = (halfword ) lua_tonumber(L, 2); + alink(b) = null; + } + return 0; +} + +static int lua_nodelib_direct_is_char(lua_State * L) +{ + halfword n; + halfword f; + n = (halfword ) lua_tointeger(L, 1); + if ((type(n) == glyph_node) && (subtype(n) < 256)) { + f = (halfword ) lua_tointeger(L, 2); + if (f && f == font(n)) { + lua_pushboolean(L,1); + return 1; + } + } + lua_pushboolean(L,0); + return 1; +} + +static int lua_nodelib_direct_setdiscretionary(lua_State * L) +{ + int t ; + halfword n; + n = (halfword ) lua_tonumber(L, 1); + if (type(n) == disc_node) { + t = lua_gettop(L) ; + if (t > 1) { + set_disc_field(pre_break(n), lua_tointeger(L,2)); + if (t > 2) { + set_disc_field(post_break(n), lua_tointeger(L,3)); + if (t > 3) { + set_disc_field(no_break(n), lua_tointeger(L,4)); + if (t > 4) { + subtype(n) = (quarterword) lua_tointeger(L,5); + if (t > 5) { + penalty(n) = lua_tointeger(L,6); + } + } + } else { + set_disc_field(no_break(n), null); + } + } else { + set_disc_field(post_break(n), null); + set_disc_field(no_break(n), null); + } + } else { + set_disc_field(pre_break(n), null); + set_disc_field(post_break(n), null); + set_disc_field(no_break(n), null); + } + } + return 0; +} + + static int lua_nodelib_direct_setfield(lua_State * L) { halfword n; @@ -6235,6 +6409,9 @@ static int lua_nodelib_direct_set_property(lua_State * L) /* hh */ return 0; } + + + static int lua_nodelib_direct_properties_get_table(lua_State * L) /* hh */ { /* <node|direct> */ lua_rawgeti(L, LUA_REGISTRYINDEX, lua_key_index(node_properties)); @@ -6275,6 +6452,68 @@ static int lua_nodelib_set_property_t(lua_State * L) /* hh */ return 0; } +/* extra helpers */ + +static int lua_nodelib_effective_glue(lua_State * L) +{ + halfword *glue; + halfword *parent; + halfword s; + int w; + glue = lua_touserdata(L, 1); + if ((glue == NULL) || (type(*glue) != glue_node)) { + lua_pushnil(L) ; + } else { + s = glue_ptr(*glue); + w = width(s) ; + parent = lua_touserdata(L, 2); + if ((parent != NULL) && ((type(*parent) == hlist_node) || (type(*parent) == vlist_node))) { + if ((int)glue_sign(*parent) == 1) { + if (stretch_order(s) == glue_order(*parent)) { + w += stretch(s) * glue_set(*parent); + } + } else if (glue_sign(*parent) == 2) { + if (shrink_order(s) == glue_order(*parent)) { + w -= shrink(s) * glue_set(*parent); + } + } + } + lua_pushnumber(L,w); + } + return 1; +} + + +static int lua_nodelib_direct_effective_glue(lua_State * L) +{ + halfword glue; + halfword parent; + halfword s; + int w; + glue = (halfword)lua_tonumber(L, 1); + if ((glue == null) || (type(glue) != glue_node)) { + lua_pushnil(L) ; + } else { + s = glue_ptr(glue); + w = width(s) ; + parent = (halfword)lua_tonumber(L, 2); + if ((parent != null) && ((type(parent) == hlist_node) || (type(parent) == vlist_node))) { + if ((int)glue_sign(parent) == 1) { + if (stretch_order(s) == glue_order(parent)) { + w += stretch(s) * glue_set(parent); + } + } else if (glue_sign(parent) == 2) { + if (shrink_order(s) == glue_order(parent)) { + w -= shrink(s) * glue_set(parent); + } + } + } + lua_pushnumber(L,w); + } + return 1; +} + + static const struct luaL_Reg nodelib_p[] = { {"__index", lua_nodelib_get_property_t}, {"__newindex", lua_nodelib_set_property_t}, @@ -6316,17 +6555,20 @@ static const struct luaL_Reg direct_nodelib_f[] = { {"free", lua_nodelib_direct_free}, {"getbox", lua_nodelib_direct_getbox}, {"getchar", lua_nodelib_direct_getcharacter}, + {"getdisc", lua_nodelib_direct_getdiscretionary}, {"getfield", lua_nodelib_direct_getfield}, {"getfont", lua_nodelib_direct_getfont}, {"getid", lua_nodelib_direct_getid}, {"getnext", lua_nodelib_direct_getnext}, {"getprev", lua_nodelib_direct_getprev}, + {"getboth", lua_nodelib_direct_getboth}, {"getlist", lua_nodelib_direct_getlist}, {"getleader", lua_nodelib_direct_getleader}, {"getsubtype", lua_nodelib_direct_getsubtype}, {"has_glyph", lua_nodelib_direct_has_glyph}, {"has_attribute", lua_nodelib_direct_has_attribute}, {"has_field", lua_nodelib_direct_has_field}, + {"is_char", lua_nodelib_direct_is_char}, {"hpack", lua_nodelib_direct_hpack}, /* {"id", lua_nodelib_id}, */ /* no node argument */ {"insert_after", lua_nodelib_direct_insert_after}, @@ -6348,6 +6590,12 @@ static const struct luaL_Reg direct_nodelib_f[] = { {"set_attribute", lua_nodelib_direct_set_attribute}, {"setbox", lua_nodelib_direct_setbox}, {"setfield", lua_nodelib_direct_setfield}, + {"setchar", lua_nodelib_direct_setcharacter}, + {"setdisc", lua_nodelib_direct_setdiscretionary}, + {"setnext", lua_nodelib_direct_setnext}, + {"setprev", lua_nodelib_direct_setprev}, + {"setboth", lua_nodelib_direct_setboth}, + {"setlink", lua_nodelib_direct_setlink}, {"slide", lua_nodelib_direct_slide}, /* {"subtype", lua_nodelib_subtype}, */ /* no node argument */ {"tail", lua_nodelib_direct_tail}, @@ -6371,6 +6619,7 @@ static const struct luaL_Reg direct_nodelib_f[] = { {"get_properties_table",lua_nodelib_direct_properties_get_table}, /* hh experiment */ {"getproperty", lua_nodelib_direct_get_property}, /* bonus */ /* hh experiment */ {"setproperty", lua_nodelib_direct_set_property}, /* bonus */ /* hh experiment */ + {"effective_glue", lua_nodelib_direct_effective_glue}, /* done */ {NULL, NULL} /* sentinel */ }; @@ -6446,6 +6695,7 @@ static const struct luaL_Reg nodelib_f[] = { {"get_properties_table",lua_nodelib_properties_get_table}, /* bonus */ /* hh experiment */ {"getproperty", lua_nodelib_get_property}, /* hh experiment */ {"setproperty", lua_nodelib_set_property}, /* hh experiment */ + {"effective_glue", lua_nodelib_effective_glue}, /* done */ {NULL, NULL} /* sentinel */ }; diff --git a/Build/source/texk/web2c/luatexdir/lua/lstatslib.c b/Build/source/texk/web2c/luatexdir/lua/lstatslib.c index 3d995cefa0e..eeb447f5064 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lstatslib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lstatslib.c @@ -43,11 +43,6 @@ static const char *getlogname(void) return (const char *) texmf_log_name; } -/* Obsolete in 0.80.0 */ -/* static const char *get_pdftex_banner(void) */ -/* { */ -/* return (const char *) pdftex_banner; */ -/* } */ static const char *get_output_file_name(void) { @@ -205,7 +200,6 @@ static struct statistic stats[] = { {"output_file_name", 'S', (void *) &get_output_file_name}, {"log_name", 'S', (void *) &getlogname}, {"banner", 'S', (void *) &getbanner}, - {"pdftex_banner", 'S', (void *) &getbanner}, {"luatex_svn", 'G', &get_luatexsvn}, {"luatex_version", 'G', &get_luatexversion}, {"luatex_revision", 'S', (void *) &luatexrevision}, diff --git a/Build/source/texk/web2c/luatexdir/lua/ltexlib.c b/Build/source/texk/web2c/luatexdir/lua/ltexlib.c index 8883174ed2f..f3e12f9d4b3 100644 --- a/Build/source/texk/web2c/luatexdir/lua/ltexlib.c +++ b/Build/source/texk/web2c/luatexdir/lua/ltexlib.c @@ -1133,7 +1133,7 @@ static int setmathcode(lua_State * L) check_char_range(cval, "setmathcode", 8); check_char_range(fval, "setmathcode", 256); check_char_range(chval, "setmathcode", 65536*17); - set_math_code(ch, xetex_mathcode, cval,fval, chval, (quarterword) (level)); + set_math_code(ch, umath_mathcode, cval,fval, chval, (quarterword) (level)); return 0; } @@ -1190,7 +1190,7 @@ static int setdelcode(lua_State * L) check_char_range(scval, "setdelcode", 65536*17); check_char_range(lfval, "setdelcode", 256); check_char_range(lcval, "setdelcode", 65536*17); - set_del_code(ch, xetex_mathcode, sfval, scval, lfval, lcval, (quarterword) (level)); + set_del_code(ch, umath_mathcode, sfval, scval, lfval, lcval, (quarterword) (level)); return 0; } @@ -1416,14 +1416,13 @@ static int do_lastitem(lua_State * L, int cur_code) case last_node_type_code: case input_line_no_code: case badness_code: - case pdftex_version_code: case pdf_last_obj_code: case pdf_last_xform_code: case pdf_last_ximage_code: case pdf_last_ximage_pages_code: case pdf_last_annot_code: - case pdf_last_x_pos_code: - case pdf_last_y_pos_code: + case last_x_pos_code: + case last_y_pos_code: case pdf_retval_code: case pdf_last_ximage_colordepth_code: case random_seed_code: @@ -1992,8 +1991,7 @@ static int tex_extraprimitives(lua_State * L) int cs = 0; n = lua_gettop(L); if (n == 0) { - mask = etex_command + aleph_command + omega_command + - pdftex_command + luatex_command + umath_command; + mask = etex_command + pdftex_command + luatex_command + umath_command; } else { for (i = 1; i <= n; i++) { if (lua_isstring(L, i)) { @@ -2006,10 +2004,6 @@ static int tex_extraprimitives(lua_State * L) mask |= core_command; } else if (lua_key_eq(s,pdftex)) { mask |= pdftex_command; - } else if (lua_key_eq(s,aleph)) { - mask |= aleph_command; - } else if (lua_key_eq(s,omega)) { - mask |= omega_command; } else if (lua_key_eq(s,luatex)) { mask |= luatex_command | umath_command; } else if (lua_key_eq(s,umath)) { @@ -2233,13 +2227,14 @@ static int tex_run_linebreak(lua_State * L) halfword final_par_glue; int paragraph_dir = 0; /* locally initialized parameters for line breaking */ - int pretolerance, tracingparagraphs, tolerance, looseness, hyphenpenalty, - exhyphenpenalty, pdfadjustspacing, adjdemerits, pdfprotrudechars, + int pretolerance, tracingparagraphs, tolerance, looseness, + /* + hyphenpenalty, exhyphenpenalty, + */ + adjustspacing, adjdemerits, protrudechars, linepenalty, lastlinefit, doublehyphendemerits, finalhyphendemerits, hangafter, interlinepenalty, widowpenalty, clubpenalty, brokenpenalty; - halfword emergencystretch, hangindent, hsize, leftskip, rightskip, - pdfeachlineheight, pdfeachlinedepth, pdffirstlineheight, - pdflastlinedepth, pdfignoreddimen, parshape; + halfword emergencystretch, hangindent, hsize, leftskip, rightskip,parshape; int fewest_demerits = 0, actual_looseness = 0; halfword clubpenalties, interlinepenalties, widowpenalties; int save_vlink_tmp_head; @@ -2287,14 +2282,16 @@ static int tex_run_linebreak(lua_State * L) int_par(tracing_paragraphs_code)); get_int_par("tolerance", tolerance, int_par(tolerance_code)); get_int_par("looseness", looseness, int_par(looseness_code)); + /* get_int_par("hyphenpenalty", hyphenpenalty, int_par(hyphen_penalty_code)); get_int_par("exhyphenpenalty", exhyphenpenalty, int_par(ex_hyphen_penalty_code)); - get_int_par("pdfadjustspacing", pdfadjustspacing, - int_par(pdf_adjust_spacing_code)); + */ + get_int_par("adjustspacing", adjustspacing, + int_par(adjust_spacing_code)); get_int_par("adjdemerits", adjdemerits, int_par(adj_demerits_code)); - get_int_par("pdfprotrudechars", pdfprotrudechars, - int_par(pdf_protrude_chars_code)); + get_int_par("protrudechars", protrudechars, + int_par(protrude_chars_code)); get_int_par("linepenalty", linepenalty, int_par(line_penalty_code)); get_int_par("lastlinefit", lastlinefit, int_par(last_line_fit_code)); get_int_par("doublehyphendemerits", doublehyphendemerits, @@ -2315,35 +2312,25 @@ static int tex_run_linebreak(lua_State * L) get_dimen_par("hsize", hsize, dimen_par(hsize_code)); get_glue_par("leftskip", leftskip, glue_par(left_skip_code)); get_glue_par("rightskip", rightskip, glue_par(right_skip_code)); - get_dimen_par("pdfeachlineheight", pdfeachlineheight, - dimen_par(pdf_each_line_height_code)); - get_dimen_par("pdfeachlinedepth", pdfeachlinedepth, - dimen_par(pdf_each_line_depth_code)); - get_dimen_par("pdffirstlineheight", pdffirstlineheight, - dimen_par(pdf_first_line_height_code)); - get_dimen_par("pdflastlinedepth", pdflastlinedepth, - dimen_par(pdf_last_line_depth_code)); - get_dimen_par("pdfignoreddimen", pdfignoreddimen, - dimen_par(pdf_ignored_dimen_code)); ext_do_line_break(paragraph_dir, pretolerance, tracingparagraphs, tolerance, - emergencystretch, - looseness, hyphenpenalty, exhyphenpenalty, - pdfadjustspacing, + emergencystretch, looseness, + /* + hyphenpenalty, exhyphenpenalty, + */ + adjustspacing, parshape, - adjdemerits, pdfprotrudechars, + adjdemerits, protrudechars, linepenalty, lastlinefit, doublehyphendemerits, finalhyphendemerits, hangindent, hsize, hangafter, leftskip, rightskip, - pdfeachlineheight, pdfeachlinedepth, - pdffirstlineheight, pdflastlinedepth, interlinepenalties, interlinepenalty, clubpenalty, clubpenalties, widowpenalties, widowpenalty, brokenpenalty, - final_par_glue, pdfignoreddimen); + final_par_glue); /* return the generated list, and its prevdepth */ get_linebreak_info (&fewest_demerits, &actual_looseness) ; @@ -2415,8 +2402,6 @@ static int tex_run_boot(lua_State * L) zwclose(fmt_file); } fix_date_and_time(); - /* if (format == NULL) */ - /* make_pdftex_banner(); */ random_seed = (microseconds * 1000) + (epochseconds % 1000000); init_randoms(random_seed); initialize_math(); @@ -2503,7 +2488,7 @@ static int lua_math_random (lua_State *L) /* Experimental code can either become permanent or disappear. It is undocumented and mostly present in the experimental branch but for -practical reasons we also have the setup code in the regular binary. +practical reasons we also have the setup code in the regular binary. The experimental_code array is indexed by i with 1<= i <= max_experimental_code, position 0 is not used */ int experimental_code[MAX_EXPERIMENTAL_CODE_SIZE] = { 0 }; diff --git a/Build/source/texk/web2c/luatexdir/lua/luainit.w b/Build/source/texk/web2c/luatexdir/lua/luainit.w index c4f93ba2218..610aa06ec42 100644 --- a/Build/source/texk/web2c/luatexdir/lua/luainit.w +++ b/Build/source/texk/web2c/luatexdir/lua/luainit.w @@ -71,7 +71,7 @@ const_string LUATEX_IHELP[] = { " --8bit ignored, input is assumed to be in UTF-8 encoding", " --credits display credits and exit", " --debug-format enable format debugging", - " --default-translate-file= ignored, input is assumed to be in UTF-8 encoding", + " --default-translate-file=FILE ignored, input is assumed to be in UTF-8 encoding", " --disable-write18 disable \\write18{SHELL COMMAND}", " --draftmode switch on draft mode (generates no output PDF)", " --enable-write18 enable \\write18{SHELL COMMAND}", @@ -85,7 +85,7 @@ const_string LUATEX_IHELP[] = { " --interaction=STRING set interaction mode (STRING=batchmode/nonstopmode/scrollmode/errorstopmode)", " --jobname=STRING set the job name to STRING", " --kpathsea-debug=NUMBER set path searching debugging flags according to the bits of NUMBER", - " --lua=s load and execute a lua initialization script", + " --lua=FILE load and execute a lua initialization script", " --[no-]mktex=FMT disable/enable mktexFMT generation (FMT=tex/tfm)", " --nosocket disable the lua socket library", " --output-comment=STRING use STRING for DVI file comment instead of date (no effect for PDF)", @@ -98,7 +98,7 @@ const_string LUATEX_IHELP[] = { " --[no-]shell-escape disable/enable \\write18{SHELL COMMAND}", " --shell-restricted restrict \\write18 to a list of commands given in texmf.cnf", " --synctex=NUMBER enable synctex", - " --translate-file= ignored, input is assumed to be in UTF-8 encoding", + " --translate-file=FILE ignored, input is assumed to be in UTF-8 encoding", " --version display version and exit", "", "Alternate behaviour models can be obtained by special switches", diff --git a/Build/source/texk/web2c/luatexdir/lua/luatex-api.h b/Build/source/texk/web2c/luatexdir/lua/luatex-api.h index 4313b812ae4..3dff78d9b3c 100644 --- a/Build/source/texk/web2c/luatexdir/lua/luatex-api.h +++ b/Build/source/texk/web2c/luatexdir/lua/luatex-api.h @@ -406,7 +406,6 @@ make_lua_key(adjusted_hbox);\ make_lua_key(advance);\ make_lua_key(after_display);\ make_lua_key(after_output);\ -make_lua_key(aleph);\ make_lua_key(align);\ make_lua_key(align_head);\ make_lua_key(align_set);\ @@ -569,7 +568,6 @@ make_lua_key(num);\ make_lua_key(number);\ make_lua_key(objcompression);\ make_lua_key(objnum);\ -make_lua_key(omega);\ make_lua_key(ordering);\ make_lua_key(output);\ make_lua_key(pLTL);\ @@ -709,7 +707,6 @@ init_lua_key(adjusted_hbox);\ init_lua_key(advance);\ init_lua_key(after_display);\ init_lua_key(after_output);\ -init_lua_key(aleph);\ init_lua_key(align);\ init_lua_key(align_head);\ init_lua_key(align_set);\ @@ -863,7 +860,6 @@ init_lua_key(num);\ init_lua_key(number);\ init_lua_key(objcompression);\ init_lua_key(objnum);\ -init_lua_key(omega);\ init_lua_key(ordering);\ init_lua_key(output);\ init_lua_key(page);\ @@ -1076,7 +1072,6 @@ use_lua_key(adjusted_hbox); use_lua_key(advance); use_lua_key(after_display); use_lua_key(after_output); -use_lua_key(aleph); use_lua_key(align); use_lua_key(align_head); use_lua_key(align_set); @@ -1239,7 +1234,6 @@ use_lua_key(num); use_lua_key(number); use_lua_key(objcompression); use_lua_key(objnum); -use_lua_key(omega); use_lua_key(ordering); use_lua_key(output); use_lua_key(pLTL); diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdffont.w b/Build/source/texk/web2c/luatexdir/pdf/pdffont.w index 174e1b6289e..57332605d42 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdffont.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdffont.w @@ -281,7 +281,7 @@ void read_expand_font(void) pdf_error("font expansion", "invalid font identifier"); //if (pdf_font_blink(f) != null_font) // pdf_error("font expansion", - // "\\pdffontexpand cannot be used this way (the base font has been expanded)"); + // "\\fontexpand cannot be used this way (the base font has been expanded)"); scan_optional_equals(); scan_int(); stretch_limit = fix_int(cur_val, 0, 1000); diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfimage.w b/Build/source/texk/web2c/luatexdir/pdf/pdfimage.w index 008f8f383ba..f9b6cf52619 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfimage.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfimage.w @@ -38,7 +38,7 @@ void place_img(PDF pdf, image_dict * idict, scaled_whd dim, int transform) assert(p != NULL); a[0] = a[3] = 1.0e6; a[1] = a[2] = 0; - if (img_type(idict) == IMG_TYPE_PDF + if (img_type(idict) == IMG_TYPE_PDF || img_type(idict) == IMG_TYPE_PDFMEMSTREAM || img_type(idict) == IMG_TYPE_PDFSTREAM) { a[0] /= (float) img_xsize(idict); a[3] /= (float) img_ysize(idict); diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdflistout.w b/Build/source/texk/web2c/luatexdir/pdf/pdflistout.w index 1c3b40de36f..c1764f49c0c 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdflistout.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdflistout.w @@ -482,7 +482,7 @@ void hlist_out(PDF pdf, halfword this_box) case whatsit_node: /* Output the whatsit node |p| in |hlist_out| */ switch (subtype(p)) { - case pdf_save_pos_node: + case save_pos_node: pdf_last_pos = pdf->posstruct->pos; pos_info.curpos = pdf->posstruct->pos; pos_info.boxpos.pos = refpos->pos; @@ -928,7 +928,7 @@ void vlist_out(PDF pdf, halfword this_box) case whatsit_node: /* Output the whatsit node |p| in |vlist_out| */ switch (subtype(p)) { - case pdf_save_pos_node: + case save_pos_node: pdf_last_pos = pdf->posstruct->pos; pos_info.curpos = pdf->posstruct->pos; pos_info.boxpos.pos = refpos->pos; diff --git a/Build/source/texk/web2c/luatexdir/ptexlib.h b/Build/source/texk/web2c/luatexdir/ptexlib.h index ff7cde4f440..5855931d854 100644 --- a/Build/source/texk/web2c/luatexdir/ptexlib.h +++ b/Build/source/texk/web2c/luatexdir/ptexlib.h @@ -53,10 +53,6 @@ extern char **suffixlist; /* in luainit.w */ # define eTeX_minor_version 2 /* \.{\\eTeXminorversion} */ # define eTeX_revision ".2" /* \.{\\eTeXrevision} */ -# define pdftex_version_string "-2.00.0" - /* current \pdfTeX\ version */ -# define pdftex_version 200 /* \.{\\pdftexversion} */ -# define pdftex_revision "0" /* \.{\\pdftexrevision} */ #define LUA_COMPAT_MODULE 1 # include "lua.h" diff --git a/Build/source/texk/web2c/luatexdir/tex/align.w b/Build/source/texk/web2c/luatexdir/tex/align.w index adc30a46007..5b8a1a4417e 100644 --- a/Build/source/texk/web2c/luatexdir/tex/align.w +++ b/Build/source/texk/web2c/luatexdir/tex/align.w @@ -40,7 +40,6 @@ void init_col(void); #define every_cr equiv(every_cr_loc) #define display_indent dimen_par(display_indent_code) #define max_depth dimen_par(max_depth_code) -#define pdf_ignored_dimen dimen_par(pdf_ignored_dimen_code) #define overfull_rule dimen_par(overfull_rule_code) @ It's sort of a miracle whenever \.{\\halign} and \.{\\valign} work, because @@ -494,7 +493,7 @@ static void init_span(pointer p) if (cur_list.mode_field == -hmode) { space_factor = 1000; } else { - prev_depth = pdf_ignored_dimen; + prev_depth = ignore_depth; normal_paragraph(); } cur_span = p; diff --git a/Build/source/texk/web2c/luatexdir/tex/buildpage.w b/Build/source/texk/web2c/luatexdir/tex/buildpage.w index 68cb3fecc5a..54a57d15d0d 100644 --- a/Build/source/texk/web2c/luatexdir/tex/buildpage.w +++ b/Build/source/texk/web2c/luatexdir/tex/buildpage.w @@ -38,7 +38,6 @@ #define vsize dimen_par(vsize_code) #define vfuzz dimen_par(vfuzz_code) #define max_depth dimen_par(max_depth_code) -#define pdf_ignored_dimen dimen_par(pdf_ignored_dimen_code) #define output_routine equiv(output_routine_loc) #define split_top_skip glue_par(split_top_skip_code) @@ -971,7 +970,7 @@ void fire_up(halfword c) incr(dead_cycles); push_nest(); mode = -vmode; - prev_depth = pdf_ignored_dimen; + prev_depth = ignore_depth; mode_line = -line; begin_token_list(output_routine, output_text); new_save_level(output_group); diff --git a/Build/source/texk/web2c/luatexdir/tex/commands.h b/Build/source/texk/web2c/luatexdir/tex/commands.h index 0a0663f428b..c8200ab93f8 100644 --- a/Build/source/texk/web2c/luatexdir/tex/commands.h +++ b/Build/source/texk/web2c/luatexdir/tex/commands.h @@ -235,9 +235,6 @@ typedef enum { font_name_code, /* command code for \.{\\fontname} */ etex_code, /* command code for \.{\\eTeXVersion} */ format_name_code, /* command code for \.{\\AlephVersion} */ - pdftex_revision_code, /* command code for \.{\\pdftexrevision}: OBSOLETE */ -# define pdftex_first_expand_code pdftex_revision_code /* base for \pdfTeX's command codes */ - /*pdftex_banner_code,*/ /* command code for \.{\\pdftexbanner}: OBSOLETE */ luatex_banner_code, /* command code for \.{\\luatexbanner}: */ pdf_font_name_code, /* command code for \.{\\pdffontname} */ pdf_font_objnum_code, /* command code for \.{\\pdffontobjnum} */ @@ -274,15 +271,13 @@ typedef enum { last_node_type_code, /* code for \.{\\lastnodetype} */ input_line_no_code, /* code for \.{\\inputlineno} */ badness_code, /* code for \.{\\badness} */ - pdftex_version_code, /* code for \.{\\pdftexversion} */ /*OBSOLETE */ -# define pdftex_first_rint_code pdftex_version_code /* base for \pdfTeX's command codes */ pdf_last_obj_code, /* code for \.{\\pdflastobj} */ pdf_last_xform_code, /* code for \.{\\pdflastxform} */ pdf_last_ximage_code, /* code for \.{\\pdflastximage} */ pdf_last_ximage_pages_code, /* code for \.{\\pdflastximagepages} */ pdf_last_annot_code, /* code for \.{\\pdflastannot} */ - pdf_last_x_pos_code, /* code for \.{\\pdflastxpos} */ - pdf_last_y_pos_code, /* code for \.{\\pdflastypos} */ + last_x_pos_code, /* code for \.{\\lastxpos} */ + last_y_pos_code, /* code for \.{\\lastypos} */ pdf_retval_code, /* global multi-purpose return value */ pdf_last_ximage_colordepth_code, /* code for \.{\\pdflastximagecolordepth} */ random_seed_code, /* code for \.{\\pdfrandomseed} */ diff --git a/Build/source/texk/web2c/luatexdir/tex/commands.w b/Build/source/texk/web2c/luatexdir/tex/commands.w index 09b86cd17bc..2b0f1d83bc5 100644 --- a/Build/source/texk/web2c/luatexdir/tex/commands.w +++ b/Build/source/texk/web2c/luatexdir/tex/commands.w @@ -238,10 +238,10 @@ void initialize_commands(void) int_base + pdf_image_hicolor_code, int_base); primitive_pdftex("pdfimageapplygamma", assign_int_cmd, int_base + pdf_image_apply_gamma_code, int_base); - primitive_pdftex("pdfadjustspacing", assign_int_cmd, - int_base + pdf_adjust_spacing_code, int_base); - primitive_pdftex("pdfprotrudechars", assign_int_cmd, - int_base + pdf_protrude_chars_code, int_base); + primitive_luatex("adjustspacing", assign_int_cmd, + int_base + adjust_spacing_code, int_base); + primitive_luatex("protrudechars", assign_int_cmd, + int_base + protrude_chars_code, int_base); primitive_pdftex("pdftracingfonts", assign_int_cmd, int_base + pdf_tracing_fonts_code, int_base); primitive_pdftex("pdfgentounicode", assign_int_cmd, @@ -298,30 +298,16 @@ void initialize_commands(void) dimen_base + pdf_h_origin_code, dimen_base); primitive_pdftex("pdfvorigin", assign_dimen_cmd, dimen_base + pdf_v_origin_code, dimen_base); - primitive_omega("pagewidth", assign_dimen_cmd, dimen_base + page_width_code, + primitive_luatex("pagewidth", assign_dimen_cmd, dimen_base + page_width_code, dimen_base); - primitive_pdftex("pdfpagewidth", assign_dimen_cmd, - dimen_base + page_width_code, dimen_base); - primitive_omega("pageheight", assign_dimen_cmd, + primitive_luatex("pageheight", assign_dimen_cmd, dimen_base + page_height_code, dimen_base); - primitive_pdftex("pdfpageheight", assign_dimen_cmd, - dimen_base + page_height_code, dimen_base); primitive_pdftex("pdflinkmargin", assign_dimen_cmd, dimen_base + pdf_link_margin_code, dimen_base); primitive_pdftex("pdfdestmargin", assign_dimen_cmd, dimen_base + pdf_dest_margin_code, dimen_base); primitive_pdftex("pdfthreadmargin", assign_dimen_cmd, dimen_base + pdf_thread_margin_code, dimen_base); - primitive_pdftex("pdffirstlineheight", assign_dimen_cmd, - dimen_base + pdf_first_line_height_code, dimen_base); - primitive_pdftex("pdflastlinedepth", assign_dimen_cmd, - dimen_base + pdf_last_line_depth_code, dimen_base); - primitive_pdftex("pdfeachlineheight", assign_dimen_cmd, - dimen_base + pdf_each_line_height_code, dimen_base); - primitive_pdftex("pdfeachlinedepth", assign_dimen_cmd, - dimen_base + pdf_each_line_depth_code, dimen_base); - primitive_pdftex("pdfignoreddimen", assign_dimen_cmd, - dimen_base + pdf_ignored_dimen_code, dimen_base); primitive_pdftex("pdfpxdimen", assign_dimen_cmd, dimen_base + pdf_px_dimen_code, dimen_base); @@ -347,14 +333,14 @@ void initialize_commands(void) eqtb[frozen_end_group] = eqtb[cur_val]; primitive_tex("expandafter", expand_after_cmd, 0, 0); primitive_tex("font", def_font_cmd, 0, 0); - primitive_pdftex("letterspacefont", letterspace_font_cmd, 0, 0); + primitive_luatex("letterspacefont", letterspace_font_cmd, 0, 0); primitive_pdftex("pdfcopyfont", pdf_copy_font_cmd, 0, 0); primitive_tex("fontdimen", assign_font_dimen_cmd, 0, 0); primitive_tex("halign", halign_cmd, 0, 0); primitive_tex("hrule", hrule_cmd, 0, 0); primitive_tex("ignorespaces", ignore_spaces_cmd, 0, 0); primitive_tex("insert", insert_cmd, 0, 0); - primitive_omega("leftghost", char_ghost_cmd, 0, 0); + primitive_luatex("leftghost", char_ghost_cmd, 0, 0); primitive_tex("mark", mark_cmd, 0, 0); primitive_tex("mathaccent", math_accent_cmd, 0, 0); primitive_umath("Umathaccent", math_accent_cmd, 1, 0); @@ -368,7 +354,6 @@ void initialize_commands(void) primitive_tex("noboundary", no_boundary_cmd, 0, 0); primitive_tex("noexpand", no_expand_cmd, 0, 0); primitive_luatex("primitive", no_expand_cmd, 1, 0); - primitive_pdftex("pdfprimitive", no_expand_cmd, 1, 0); primitive_tex("nonscript", non_script_cmd, 0, 0); primitive_tex("omit", omit_cmd, 0, 0); primitive_tex("parshape", set_tex_shape_cmd, par_shape_loc, par_shape_loc); @@ -385,7 +370,7 @@ void initialize_commands(void) primitive_tex("relax", relax_cmd, too_big_char, too_big_char); cs_text(frozen_relax) = maketexstring("relax"); eqtb[frozen_relax] = eqtb[cur_val]; - primitive_omega("rightghost", char_ghost_cmd, 1, 0); + primitive_luatex("rightghost", char_ghost_cmd, 1, 0); primitive_tex("setbox", set_box_cmd, 0, 0); primitive_tex("the", the_cmd, 0, 0); primitive_tex("toks", toks_register_cmd, 0, 0); @@ -428,7 +413,7 @@ void initialize_commands(void) /* The hash table is initialized with `\.{\\count}', `\.{\\attribute}', `\.{\\dimen}', `\.{\\skip}', and `\.{\\muskip}' all having |register| as their command code; they are distinguished by the |chr_code|, which - is either |int_val|, |attr_val|, |dimen_val|, |glue_val|, or |mu_val|. + is either |int_val|, |attr_val|, |dimen_val|, |glue_val|, or |mu_val|. */ primitive_tex("count", register_cmd, int_val_level, 0); primitive_luatex("attribute", register_cmd, attr_val_level, 0); @@ -448,7 +433,6 @@ void initialize_commands(void) primitive_tex("lastskip", last_item_cmd, lastskip_code, 0); primitive_tex("inputlineno", last_item_cmd, input_line_no_code, 0); primitive_tex("badness", last_item_cmd, badness_code, 0); - primitive_pdftex("pdftexversion", last_item_cmd, luatex_version_code, 0); /*OBSOLETE */ primitive_luatex("luatexversion", last_item_cmd, luatex_version_code, 0); primitive_pdftex("pdflastobj", last_item_cmd, pdf_last_obj_code, 0); primitive_pdftex("pdflastxform", last_item_cmd, pdf_last_xform_code, 0); @@ -456,12 +440,12 @@ void initialize_commands(void) primitive_pdftex("pdflastximagepages", last_item_cmd, pdf_last_ximage_pages_code, 0); primitive_pdftex("pdflastannot", last_item_cmd, pdf_last_annot_code, 0); - primitive_pdftex("pdflastxpos", last_item_cmd, pdf_last_x_pos_code, 0); - primitive_pdftex("pdflastypos", last_item_cmd, pdf_last_y_pos_code, 0); + primitive_luatex("lastxpos", last_item_cmd, last_x_pos_code, 0); + primitive_luatex("lastypos", last_item_cmd, last_y_pos_code, 0); primitive_pdftex("pdfretval", last_item_cmd, pdf_retval_code, 0); primitive_pdftex("pdflastximagecolordepth", last_item_cmd, pdf_last_ximage_colordepth_code, 0); - primitive_pdftex("pdfrandomseed", last_item_cmd, random_seed_code, 0); + primitive_luatex("randomseed", last_item_cmd, random_seed_code, 0); primitive_pdftex("pdflastlink", last_item_cmd, pdf_last_link_code, 0); primitive_tex("number", convert_cmd, number_code, 0); @@ -471,28 +455,26 @@ void initialize_commands(void) primitive_etex("eTeXVersion", convert_cmd, etex_code, 0); primitive_tex("fontname", convert_cmd, font_name_code, 0); primitive_luatex("fontid", convert_cmd, font_id_code, 0); - primitive_pdftex("pdftexrevision", convert_cmd, luatex_revision_code, 0); /*OBSOLETE*/ primitive_luatex("luatexrevision", convert_cmd, luatex_revision_code, 0); primitive_luatex("luatexdatestamp", convert_cmd, luatex_date_code, 0); - primitive_pdftex("pdftexbanner", convert_cmd, luatex_banner_code, 0); /*OBSOLETE*/ - primitive_pdftex("luatexbanner", convert_cmd, luatex_banner_code, 0); /*will replace pdftexbanner*/ + primitive_luatex("luatexbanner", convert_cmd, luatex_banner_code, 0); primitive_pdftex("pdffontname", convert_cmd, pdf_font_name_code, 0); primitive_pdftex("pdffontobjnum", convert_cmd, pdf_font_objnum_code, 0); primitive_pdftex("pdffontsize", convert_cmd, pdf_font_size_code, 0); primitive_pdftex("pdfpageref", convert_cmd, pdf_page_ref_code, 0); - primitive_pdftex("leftmarginkern", convert_cmd, left_margin_kern_code, 0); - primitive_pdftex("rightmarginkern", convert_cmd, right_margin_kern_code, 0); + primitive_luatex("leftmarginkern", convert_cmd, left_margin_kern_code, 0); + primitive_luatex("rightmarginkern", convert_cmd, right_margin_kern_code, 0); primitive_pdftex("pdfxformname", convert_cmd, pdf_xform_name_code, 0); primitive_pdftex("pdfcreationdate", convert_cmd, pdf_creation_date_code, 0); - primitive_pdftex("pdfuniformdeviate", convert_cmd, uniform_deviate_code, 0); + primitive_luatex("uniformdeviate", convert_cmd, uniform_deviate_code, 0); primitive_pdftex("pdfcolorstackinit", convert_cmd, pdf_colorstack_init_code, 0); - primitive_pdftex("pdfnormaldeviate", convert_cmd, normal_deviate_code, 0); + primitive_luatex("normaldeviate", convert_cmd, normal_deviate_code, 0); primitive_core("directlua", convert_cmd, lua_code, 0); primitive_luatex("luafunction", convert_cmd, lua_function_code, 0); primitive_luatex("luaescapestring", convert_cmd, lua_escape_string_code, 0); primitive_luatex("mathstyle", convert_cmd, math_style_code, 0); - primitive_pdftex("expanded", convert_cmd, expanded_code, 0); + primitive_luatex("expanded", convert_cmd, expanded_code, 0); primitive_tex("jobname", convert_cmd, job_name_code, 0); primitive_luatex("formatname", convert_cmd, format_name_code, 0); primitive_pdftex("pdfinsertht", convert_cmd, pdf_insert_ht_code, 0); @@ -518,8 +500,6 @@ void initialize_commands(void) primitive_tex("iffalse", if_test_cmd, if_false_code, 0); primitive_tex("ifcase", if_test_cmd, if_case_code, 0); primitive_luatex("ifprimitive", if_test_cmd, if_primitive_code, 0); - primitive_pdftex("ifpdfprimitive", if_test_cmd, if_primitive_code, 0); - primitive_tex("fi", fi_or_else_cmd, fi_code, 0); cs_text(frozen_fi) = maketexstring("fi"); eqtb[frozen_fi] = eqtb[cur_val]; @@ -593,10 +573,10 @@ void initialize_commands(void) primitive_tex("cleaders", leader_ship_cmd, c_leaders, 0); primitive_tex("xleaders", leader_ship_cmd, x_leaders, 0); primitive_luatex("gleaders", leader_ship_cmd, g_leaders, 0); - primitive_aleph("boxdir", assign_box_dir_cmd, 0, 0); + primitive_luatex("boxdir", assign_box_dir_cmd, 0, 0); primitive_tex("indent", start_par_cmd, 1, 0); primitive_tex("noindent", start_par_cmd, 0, 0); - primitive_pdftex("quitvmode", start_par_cmd, 2, 0); + primitive_luatex("quitvmode", start_par_cmd, 2, 0); primitive_tex("unpenalty", remove_item_cmd, penalty_node, 0); primitive_tex("unkern", remove_item_cmd, kern_node, 0); primitive_tex("unskip", remove_item_cmd, glue_node, 0); @@ -606,8 +586,8 @@ void initialize_commands(void) primitive_tex("unvcopy", un_vbox_cmd, copy_code, 0); primitive_tex("-", discretionary_cmd, explicit_disc, 0); primitive_tex("discretionary", discretionary_cmd, discretionary_disc, 0); - primitive_omega("localleftbox", assign_local_box_cmd, 0, 0); - primitive_omega("localrightbox", assign_local_box_cmd, 1, 0); + primitive_luatex("localleftbox", assign_local_box_cmd, 0, 0); + primitive_luatex("localrightbox", assign_local_box_cmd, 1, 0); primitive_umath("Ustartmath", math_shift_cs_cmd, text_style, 0); primitive_umath("Ustopmath", math_shift_cs_cmd, cramped_text_style, 0); @@ -923,13 +903,14 @@ void initialize_commands(void) primitive_luatex("posthyphenchar", hyph_data_cmd, 3, 0); primitive_luatex("preexhyphenchar", hyph_data_cmd, 4, 0); primitive_luatex("postexhyphenchar", hyph_data_cmd, 5, 0); + primitive_luatex("hyphenationmin", hyph_data_cmd, 6, 0); primitive_tex("hyphenchar", assign_font_int_cmd, 0, 0); primitive_tex("skewchar", assign_font_int_cmd, 1, 0); - primitive_pdftex("lpcode", assign_font_int_cmd, lp_code_base, 0); - primitive_pdftex("rpcode", assign_font_int_cmd, rp_code_base, 0); - primitive_pdftex("efcode", assign_font_int_cmd, ef_code_base, 0); - primitive_pdftex("tagcode", assign_font_int_cmd, tag_code, 0); - primitive_pdftex("pdfnoligatures", assign_font_int_cmd, no_lig_code, 0); + primitive_luatex("lpcode", assign_font_int_cmd, lp_code_base, 0); + primitive_luatex("rpcode", assign_font_int_cmd, rp_code_base, 0); + primitive_luatex("efcode", assign_font_int_cmd, ef_code_base, 0); + primitive_luatex("tagcode", assign_font_int_cmd, tag_code, 0); + primitive_luatex("ignoreligaturesinfont", assign_font_int_cmd, no_lig_code, 0); primitive_tex("batchmode", set_interaction_cmd, batch_mode, 0); primitive_tex("nonstopmode", set_interaction_cmd, nonstop_mode, 0); primitive_tex("scrollmode", set_interaction_cmd, scroll_mode, 0); @@ -953,27 +934,27 @@ void initialize_commands(void) cs_text(frozen_special) = maketexstring("special"); eqtb[frozen_special] = eqtb[cur_val]; primitive_tex("immediate", extension_cmd, immediate_code, 0); - primitive_omega("localinterlinepenalty", assign_int_cmd, + primitive_luatex("localinterlinepenalty", assign_int_cmd, int_base + local_inter_line_penalty_code, int_base); - primitive_omega("localbrokenpenalty", assign_int_cmd, + primitive_luatex("localbrokenpenalty", assign_int_cmd, int_base + local_broken_penalty_code, int_base); - primitive_omega("pagedir", assign_dir_cmd, int_base + page_direction_code, + primitive_luatex("pagedir", assign_dir_cmd, int_base + page_direction_code, dir_base); - primitive_omega("bodydir", assign_dir_cmd, int_base + body_direction_code, + primitive_luatex("bodydir", assign_dir_cmd, int_base + body_direction_code, dir_base); - primitive_omega("pardir", assign_dir_cmd, int_base + par_direction_code, + primitive_luatex("pardir", assign_dir_cmd, int_base + par_direction_code, dir_base); - primitive_omega("textdir", assign_dir_cmd, int_base + text_direction_code, + primitive_luatex("textdir", assign_dir_cmd, int_base + text_direction_code, dir_base); - primitive_omega("mathdir", assign_dir_cmd, int_base + math_direction_code, + primitive_luatex("mathdir", assign_dir_cmd, int_base + math_direction_code, dir_base); primitive_luatex("pageleftoffset", assign_dimen_cmd, dimen_base + page_left_offset_code, dimen_base); primitive_luatex("pagetopoffset", assign_dimen_cmd, dimen_base + page_top_offset_code, dimen_base); - primitive_aleph("pagerightoffset", assign_dimen_cmd, + primitive_luatex("pagerightoffset", assign_dimen_cmd, dimen_base + page_right_offset_code, dimen_base); - primitive_aleph("pagebottomoffset", assign_dimen_cmd, + primitive_luatex("pagebottomoffset", assign_dimen_cmd, dimen_base + page_bottom_offset_code, dimen_base); primitive_pdftex("pdfliteral", extension_cmd, pdf_literal_node, 0); primitive_pdftex("pdfcolorstack", extension_cmd, pdf_colorstack_node, 0); @@ -994,7 +975,7 @@ void initialize_commands(void) primitive_pdftex("pdfthread", extension_cmd, pdf_thread_node, 0); primitive_pdftex("pdfstartthread", extension_cmd, pdf_start_thread_node, 0); primitive_pdftex("pdfendthread", extension_cmd, pdf_end_thread_node, 0); - primitive_pdftex("pdfsavepos", extension_cmd, pdf_save_pos_node, 0); + primitive_luatex("savepos", extension_cmd, save_pos_node, 0); primitive_pdftex("pdfinfo", extension_cmd, pdf_info_code, 0); primitive_pdftex("pdfcatalog", extension_cmd, pdf_catalog_code, 0); primitive_pdftex("pdfnames", extension_cmd, pdf_names_code, 0); @@ -1008,10 +989,10 @@ void initialize_commands(void) save_cat_code_table_code, 0); primitive_luatex("initcatcodetable", extension_cmd, init_cat_code_table_code, 0); - primitive_pdftex("pdfsetrandomseed", extension_cmd, set_random_seed_code, + primitive_luatex("setrandomseed", extension_cmd, set_random_seed_code, 0); primitive_luatex("latelua", extension_cmd, late_lua_node, 0); - primitive_pdftex("pdffontexpand", extension_cmd, pdf_font_expand_code, 0); + primitive_pdftex("expandglyphsinfont", extension_cmd, font_expand_code, 0); primitive_pdftex("pdfglyphtounicode", extension_cmd, pdf_glyph_to_unicode_code, 0); @@ -1078,14 +1059,9 @@ void initialize_etex_commands(void) primitive_etex("currentiflevel", last_item_cmd, current_if_level_code, 0); primitive_etex("currentiftype", last_item_cmd, current_if_type_code, 0); primitive_etex("currentifbranch", last_item_cmd, current_if_branch_code, 0); - - primitive_omega("charwd", last_item_cmd, font_char_wd_code, 0); primitive_etex("fontcharwd", last_item_cmd, font_char_wd_code, 0); - primitive_omega("charht", last_item_cmd, font_char_ht_code, 0); primitive_etex("fontcharht", last_item_cmd, font_char_ht_code, 0); - primitive_omega("chardp", last_item_cmd, font_char_dp_code, 0); primitive_etex("fontchardp", last_item_cmd, font_char_dp_code, 0); - primitive_omega("charit", last_item_cmd, font_char_ic_code, 0); primitive_etex("fontcharic", last_item_cmd, font_char_ic_code, 0); primitive_etex("parshapelength", last_item_cmd, par_shape_length_code, 0); @@ -1126,11 +1102,9 @@ void initialize_etex_commands(void) primitive_etex("ifdefined", if_test_cmd, if_def_code, 0); primitive_etex("ifcsname", if_test_cmd, if_cs_code, 0); primitive_etex("iffontchar", if_test_cmd, if_font_char_code, 0); - primitive_pdftex("ifincsname", if_test_cmd, if_in_csname_code, 0); + primitive_luatex("ifincsname", if_test_cmd, if_in_csname_code, 0); primitive_luatex("ifabsnum", if_test_cmd, if_abs_num_code, 0); primitive_luatex("ifabsdim", if_test_cmd, if_abs_dim_code, 0); - primitive_pdftex("ifpdfabsnum", if_test_cmd, if_abs_num_code, 0); - primitive_pdftex("ifpdfabsdim", if_test_cmd, if_abs_dim_code, 0); /* The |protected| feature of \eTeX\ defines the \.{\\protected} prefix command for macro definitions. Such macros are protected against diff --git a/Build/source/texk/web2c/luatexdir/tex/dumpdata.w b/Build/source/texk/web2c/luatexdir/tex/dumpdata.w index 4bf7b9c0941..a13a456072a 100644 --- a/Build/source/texk/web2c/luatexdir/tex/dumpdata.w +++ b/Build/source/texk/web2c/luatexdir/tex/dumpdata.w @@ -26,8 +26,8 @@ #define prev_depth cur_list.prev_depth_field /* 907 = sum of the values of the bytes of "don knuth" */ -/* The next FORMAT_ID will be 907+3 */ -#define FORMAT_ID (907+2) +/* The next FORMAT_ID will be 907+5 */ +#define FORMAT_ID (907+4) #if ((FORMAT_ID>=0) && (FORMAT_ID<=256)) #error Wrong value for FORMAT_ID. #endif @@ -506,7 +506,6 @@ boolean load_fmt_file(const char *fmtname) undump_font(k); } undump_math_data(); - /*make_pdftex_banner();*/ /* Undump the hyphenation tables */ undump_language_data(); @@ -527,7 +526,7 @@ boolean load_fmt_file(const char *fmtname) /* Undump the lua bytecodes */ undump_luac_registers(); - prev_depth = dimen_par(pdf_ignored_dimen_code); + prev_depth = ignore_depth; return true; /* it worked! */ BAD_FMT: wake_up_terminal(); diff --git a/Build/source/texk/web2c/luatexdir/tex/equivalents.h b/Build/source/texk/web2c/luatexdir/tex/equivalents.h index 3995f024c0e..02e53e381ab 100644 --- a/Build/source/texk/web2c/luatexdir/tex/equivalents.h +++ b/Build/source/texk/web2c/luatexdir/tex/equivalents.h @@ -1,5 +1,5 @@ /* equivalents.h - + Copyright 2009 Taco Hoekwater <taco@luatex.org> This file is part of LuaTeX. @@ -279,7 +279,11 @@ here, and the |number_regs| \.{\\dimen} registers. # define output_box_code 64 # define cur_lang_code 65 /* current language id */ # define ex_hyphen_char_code 66 -# define pdftex_first_integer_code 67 /*base for \pdfTeX's integer parameters */ +# define hyphenation_min_code 67 /* minimum word length */ +# define adjust_spacing_code 68 /*level of spacing adjusting */ +# define protrude_chars_code 69 /*protrude chars at left/right edge of paragraphs */ + +# define pdftex_first_integer_code 70 /*base for \pdfTeX's integer parameters */ # define pdf_output_code (pdftex_first_integer_code + 0) /*switch on PDF output if positive */ # define pdf_compress_level_code (pdftex_first_integer_code + 1) @@ -292,23 +296,21 @@ here, and the |number_regs| \.{\\dimen} registers. /*generate unique names for resouces */ # define pdf_minor_version_code (pdftex_first_integer_code + 6) /*fractional part of the PDF version produced */ # define pdf_pagebox_code (pdftex_first_integer_code + 7) /*default pagebox to use for PDF inclusion */ -# define pdf_inclusion_errorlevel_code (pdftex_first_integer_code + 8) /*if the PDF inclusion should treat pdfs +# define pdf_inclusion_errorlevel_code (pdftex_first_integer_code + 8) /*if the PDF inclusion should treat pdfs newer than |pdf_minor_version| as an error */ # define pdf_gamma_code (pdftex_first_integer_code + 9) # define pdf_image_gamma_code (pdftex_first_integer_code + 10) # define pdf_image_hicolor_code (pdftex_first_integer_code + 11) # define pdf_image_apply_gamma_code (pdftex_first_integer_code + 12) -# define pdf_adjust_spacing_code (pdftex_first_integer_code + 13) /*level of spacing adjusting */ -# define pdf_protrude_chars_code (pdftex_first_integer_code + 14) /*protrude chars at left/right edge of paragraphs */ -# define pdf_tracing_fonts_code (pdftex_first_integer_code + 15) +# define pdf_tracing_fonts_code (pdftex_first_integer_code + 13) /*level of font detail in log */ -# define pdf_objcompresslevel_code (pdftex_first_integer_code + 16) /*activate object streams */ -# define pdf_gen_tounicode_code (pdftex_first_integer_code + 17) +# define pdf_objcompresslevel_code (pdftex_first_integer_code + 14) /*activate object streams */ +# define pdf_gen_tounicode_code (pdftex_first_integer_code + 15) /*generate ToUnicode for fonts? */ -# define pdf_draftmode_code (pdftex_first_integer_code + 18) /*switch on draftmode if positive */ -# define pdf_replace_font_code (pdftex_first_integer_code + 19) /*generate ToUnicode for fonts? */ -# define pdf_inclusion_copy_font_code (pdftex_first_integer_code + 20) /*generate ToUnicode for fonts? */ -# define pdf_int_pars (pdftex_first_integer_code + 21) /*total number of \pdfTeX's integer parameters */ +# define pdf_draftmode_code (pdftex_first_integer_code + 16) /*switch on draftmode if positive */ +# define pdf_replace_font_code (pdftex_first_integer_code + 17) /*generate ToUnicode for fonts? */ +# define pdf_inclusion_copy_font_code (pdftex_first_integer_code + 18) /*generate ToUnicode for fonts? */ +# define pdf_int_pars (pdftex_first_integer_code + 19) /*total number of \pdfTeX's integer parameters */ # define etex_first_integer_code (pdf_int_pars) /*base for \eTeX's integer parameters */ # define tracing_assigns_code (etex_first_integer_code) /*show assignments */ # define tracing_groups_code (etex_first_integer_code+1) /*show save/restore groups */ @@ -378,13 +380,8 @@ here, and the |number_regs| \.{\\dimen} registers. # define pdf_link_margin_code (pdftex_first_dimen_code + 4) /* link margin in the PDF output */ # define pdf_dest_margin_code (pdftex_first_dimen_code + 5) /* dest margin in the PDF output */ # define pdf_thread_margin_code (pdftex_first_dimen_code + 6) /* thread margin in the PDF output */ -# define pdf_first_line_height_code (pdftex_first_dimen_code + 7) -# define pdf_last_line_depth_code (pdftex_first_dimen_code + 8) -# define pdf_each_line_height_code (pdftex_first_dimen_code + 9) -# define pdf_each_line_depth_code (pdftex_first_dimen_code + 10) -# define pdf_ignored_dimen_code (pdftex_first_dimen_code + 11) -# define pdf_px_dimen_code (pdftex_first_dimen_code + 12) -# define pdftex_last_dimen_code (pdftex_first_dimen_code + 12) /* last number defined in this section */ +# define pdf_px_dimen_code (pdftex_first_dimen_code + 7) +# define pdftex_last_dimen_code (pdftex_first_dimen_code + 7) /* last number defined in this section */ # define dimen_pars (pdftex_last_dimen_code + 1) /* total number of dimension parameters */ @@ -433,7 +430,7 @@ extern int cur_boundary; /* where the current level begins */ /* We use the notation |saved(k)| to stand for an item that -appears in location |save_ptr+k| of the save stack. +appears in location |save_ptr+k| of the save stack. */ # define saved_type(A) save_stack[save_ptr+(A)].type_ diff --git a/Build/source/texk/web2c/luatexdir/tex/extensions.w b/Build/source/texk/web2c/luatexdir/tex/extensions.w index c0345d3c089..30b7c05e02c 100644 --- a/Build/source/texk/web2c/luatexdir/tex/extensions.w +++ b/Build/source/texk/web2c/luatexdir/tex/extensions.w @@ -269,8 +269,8 @@ void do_extension(PDF pdf) set_pdf_font_attr(k, 0); } break; - case pdf_font_expand_code: - /* Implement \.{\\pdffontexpand} */ + case font_expand_code: + /* Implement \.{\\fontexpand} */ read_expand_font(); break; case pdf_include_chars_code: @@ -410,9 +410,9 @@ void do_extension(PDF pdf) check_o_mode(pdf, "\\pdfrefximage", 1 << OMODE_PDF, false); scan_pdfrefximage(pdf); break; - case pdf_save_pos_node: - /* Implement \.{\\pdfsavepos} */ - new_whatsit(pdf_save_pos_node); + case save_pos_node: + /* Implement \.{\\savepos} */ + new_whatsit(save_pos_node); break; case pdf_start_link_node: /* Implement \.{\\pdfstartlink} */ @@ -484,7 +484,7 @@ void do_extension(PDF pdf) } break; case set_random_seed_code: - /* Implement \.{\\pdfsetrandomseed} */ + /* Implement \.{\\setrandomseed} */ /* Negative random seed values are silently converted to positive ones */ scan_int(); if (cur_val < 0) diff --git a/Build/source/texk/web2c/luatexdir/tex/linebreak.h b/Build/source/texk/web2c/luatexdir/tex/linebreak.h index 4593cc59a4a..af51d2c25a9 100644 --- a/Build/source/texk/web2c/luatexdir/tex/linebreak.h +++ b/Build/source/texk/web2c/luatexdir/tex/linebreak.h @@ -1,5 +1,5 @@ /* linebreak.h - + Copyright 2009 Taco Hoekwater <taco@luatex.org> This file is part of LuaTeX. @@ -39,12 +39,14 @@ extern void ext_do_line_break(int paragraph_dir, int tolerance, scaled emergency_stretch, int looseness, + /* int hyphen_penalty, int ex_hyphen_penalty, - int pdf_adjust_spacing, + */ + int adjust_spacing, halfword par_shape_ptr, int adj_demerits, - int pdf_protrude_chars, + int protrude_chars, int line_penalty, int last_line_fit, int double_hyphen_demerits, @@ -54,18 +56,13 @@ extern void ext_do_line_break(int paragraph_dir, int hang_after, halfword left_skip, halfword right_skip, - int pdf_each_line_height, - int pdf_each_line_depth, - int pdf_first_line_height, - int pdf_last_line_depth, halfword inter_line_penalties_ptr, int inter_line_penalty, int club_penalty, halfword club_penalties_ptr, halfword widow_penalties_ptr, int widow_penalty, - int broken_penalty, halfword final_par_glue, - halfword pdf_ignored_dimen); + int broken_penalty, halfword final_par_glue); extern void get_linebreak_info(int *, int *); extern halfword find_protchar_left(halfword l, boolean d); diff --git a/Build/source/texk/web2c/luatexdir/tex/linebreak.w b/Build/source/texk/web2c/luatexdir/tex/linebreak.w index d49b6f0d0a8..e8cd3542a46 100644 --- a/Build/source/texk/web2c/luatexdir/tex/linebreak.w +++ b/Build/source/texk/web2c/luatexdir/tex/linebreak.w @@ -196,12 +196,14 @@ void line_break(boolean d, int line_break_context) int_par(tolerance_code), dimen_par(emergency_stretch_code), int_par(looseness_code), + /* int_par(hyphen_penalty_code), int_par(ex_hyphen_penalty_code), - int_par(pdf_adjust_spacing_code), + */ + int_par(adjust_spacing_code), equiv(par_shape_loc), int_par(adj_demerits_code), - int_par(pdf_protrude_chars_code), + int_par(protrude_chars_code), int_par(line_penalty_code), int_par(last_line_fit_code), int_par(double_hyphen_demerits_code), @@ -211,10 +213,6 @@ void line_break(boolean d, int line_break_context) int_par(hang_after_code), glue_par(left_skip_code), glue_par(right_skip_code), - dimen_par(pdf_each_line_height_code), - dimen_par(pdf_each_line_depth_code), - dimen_par(pdf_first_line_height_code), - dimen_par(pdf_last_line_depth_code), equiv(inter_line_penalties_loc), int_par(inter_line_penalty_code), int_par(club_penalty_code), @@ -222,7 +220,7 @@ void line_break(boolean d, int line_break_context) (d ? equiv(display_widow_penalties_loc) : equiv(widow_penalties_loc)), (d ? int_par(display_widow_penalty_code) : int_par(widow_penalty_code)), int_par(broken_penalty_code), - final_par_glue, dimen_par(pdf_ignored_dimen_code)); + final_par_glue); } lua_node_filter(post_linebreak_filter_callback, line_break_context, start_of_par, @@ -278,7 +276,7 @@ static halfword finite_shrink(halfword p) no break is allowed when the penalty is 10000 or more.) If |threshold| is 10000 or more, all legal breaks are considered feasible, since the |badness| function specified above never returns a value greater than~10000. - + Up to three passes might be made through the paragraph in an attempt to find at least one set of feasible breakpoints. On the first pass, we have |threshold=pretolerance| and |second_pass=final_pass=false|. @@ -394,7 +392,7 @@ static boolean check_expand_pars(internal_font_number f) } -@ searches right to left from list tail |r| to head |l|, returns 1st non-skipable item +@ searches right to left from list tail |r| to head |l|, returns 1st non-skipable item @c /*public*/ halfword find_protchar_right(halfword l, halfword r) @@ -470,7 +468,7 @@ typedef enum { after a certain point makes it possible to regard all sufficiently large line numbers as equivalent, when the looseness parameter is zero, and this makes it possible for the algorithm to save space and time. - + An ``active node'' and a ``passive node'' are created in |mem| for each feasible breakpoint that needs to be considered. Active nodes are three words long and passive nodes are two words long. We need active nodes only @@ -479,7 +477,7 @@ typedef enum { they are created. @ An active node for a given breakpoint contains six fields: - + |vlink| points to the next node in the list of active nodes; the last active node has |vlink=active|. @@ -590,7 +588,7 @@ static boolean auto_breaking; /*make |auto_breaking| accessible out of |line_b the beginning of the paragraph to a point ``after'' a break at |p| and to a point ``before'' a break at |q|; and $\gamma$ is the width of an empty line, namely the length contributed by \.{\\leftskip} and \.{\\rightskip}. - + Suppose, for example, that the paragraph consists entirely of alternating boxes and glue skips; let the boxes have widths $x_1\ldots x_n$ and let the skips have widths $y_1\ldots y_n$, so that the paragraph can be @@ -627,11 +625,11 @@ static boolean auto_breaking; /*make |auto_breaking| accessible out of |line_b nodes to~|cur_p|. If feasible breaks are possible, new break nodes are created. If |cur_p| is too far from an active node, that node is deactivated. - + The parameter |pi| to |try_break| is the penalty associated with a break at |cur_p|; we have |pi=eject_penalty| if the break is forced, and |pi=inf_penalty| if the break is illegal. - + The other parameter, |break_type|, is set to |hyphenated_node| or |unhyphenated_node|, depending on whether or not the current break is at a |disc_node|. The end of a paragraph is also regarded as `|hyphenated_node|'; this case is @@ -663,7 +661,7 @@ static scaled disc_width[10] = { 0 }; /* the length of discretionary material keeps track of the smallest value in the |minimal_demerits| array. @c -static int minimal_demerits[4]; /* best total demerits known for current +static int minimal_demerits[4]; /* best total demerits known for current line class and position, given the fitness */ static int minimum_demerits; /* best total demerits known for current line class and position */ @@ -708,7 +706,7 @@ static int line_diff; /*the difference between the current line number @ \TeX\ makes use of the fact that |hlist_node|, |vlist_node|, - |rule_node|, |ins_node|, |mark_node|, |adjust_node|, + |rule_node|, |ins_node|, |mark_node|, |adjust_node|, |disc_node|, |whatsit_node|, and |math_node| are at the low end of the type codes, by permitting a break at glue in a list if and only if the |type| of the previous node is less than |math_node|. Furthermore, a @@ -716,7 +714,7 @@ static int line_diff; /*the difference between the current line number @c #define do_all_six(a) a(1);a(2);a(3);a(4);a(5);a(6);a(7) -#define do_seven_eight(a) if (pdf_adjust_spacing > 1) { a(8);a(9); } +#define do_seven_eight(a) if (adjust_spacing > 1) { a(8);a(9); } #define do_all_eight(a) do_all_six(a); do_seven_eight(a) #define do_one_seven_eight(a) a(1); do_seven_eight(a) @@ -725,9 +723,9 @@ static int line_diff; /*the difference between the current line number #define kern_break() { \ if ((!is_char_node(vlink(cur_p))) && auto_breaking) \ if (type(vlink(cur_p))==glue_node) \ - ext_try_break(0,unhyphenated_node, line_break_dir, pdf_adjust_spacing, \ + ext_try_break(0,unhyphenated_node, line_break_dir, adjust_spacing, \ par_shape_ptr, adj_demerits, \ - tracing_paragraphs, pdf_protrude_chars, \ + tracing_paragraphs, protrude_chars, \ line_penalty, last_line_fit, \ double_hyphen_demerits, final_hyphen_demerits,first_p,cur_p); \ if (type(cur_p)!=math_node) active_width[1]+=width(cur_p); \ @@ -776,16 +774,16 @@ static scaled best_pl_glue[4]; /*corresponding glue stretch or shrink */ Replacement texts and discretionary texts are supposed to contain -only character nodes, kern nodes, and box or rule nodes. +only character nodes, kern nodes, and box or rule nodes. @c static void add_to_widths(halfword s, int line_break_dir, - int pdf_adjust_spacing, scaled * widths) + int adjust_spacing, scaled * widths) { while (s != null) { if (is_char_node(s)) { widths[1] += pack_width(line_break_dir, dir_TRT, s, true); - if ((pdf_adjust_spacing > 1) && check_expand_pars(font(s))) { + if ((adjust_spacing > 1) && check_expand_pars(font(s))) { set_prev_char_p(s); add_char_stretch(widths[8], s); add_char_shrink(widths[9], s); @@ -797,7 +795,7 @@ static void add_to_widths(halfword s, int line_break_dir, widths[1] += pack_width(line_break_dir, box_dir(s), s, false); break; case kern_node: - if ((pdf_adjust_spacing > 1) && (subtype(s) == normal)) { + if ((adjust_spacing > 1) && (subtype(s) == normal)) { add_kern_stretch(widths[8], s); add_kern_shrink(widths[9], s); } @@ -816,19 +814,19 @@ static void add_to_widths(halfword s, int line_break_dir, } @ This function is used to substract the width of a list of nodes -(from a discretionary) from one of the width arrays. -It is used only once, but deserves it own function because of orthogonality +(from a discretionary) from one of the width arrays. +It is used only once, but deserves it own function because of orthogonality with the |add_to_widths| function. @c static void sub_from_widths(halfword s, int line_break_dir, - int pdf_adjust_spacing, scaled * widths) + int adjust_spacing, scaled * widths) { while (s != null) { /* Subtract the width of node |s| from |break_width|; */ if (is_char_node(s)) { widths[1] -= pack_width(line_break_dir, dir_TRT, s, true); - if ((pdf_adjust_spacing > 1) && check_expand_pars(font(s))) { + if ((adjust_spacing > 1) && check_expand_pars(font(s))) { set_prev_char_p(s); sub_char_stretch(widths[8], s); sub_char_shrink(widths[9], s); @@ -840,7 +838,7 @@ static void sub_from_widths(halfword s, int line_break_dir, widths[1] -= pack_width(line_break_dir, box_dir(s), s, false); break; case kern_node: - if ((pdf_adjust_spacing > 1) && (subtype(s) == normal)) { + if ((adjust_spacing > 1) && (subtype(s) == normal)) { sub_kern_stretch(widths[8], s); sub_kern_shrink(widths[9], s); } @@ -869,19 +867,19 @@ static void sub_from_widths(halfword s, int line_break_dir, subtracting |cur_active_width| from the quantity $\gamma+\beta(|cur_p|)- \alpha(|cur_p|)$. The latter quantity can be regarded as the length of a line ``from |cur_p| to |cur_p|''; we call it the |break_width| at |cur_p|. - + The |break_width| is usually negative, since it consists of the background (which is normally zero) minus the width of nodes following~|cur_p| that are eliminated after a break. If, for example, node |cur_p| is a glue node, the width of this glue is subtracted from the background; and we also look ahead to eliminate all subsequent glue and penalty and kern and math nodes, subtracting their widths as well. - + Kern nodes do not disappear at a line break unless they are |explicit|. @c static void -compute_break_width(int break_type, int line_break_dir, int pdf_adjust_spacing, +compute_break_width(int break_type, int line_break_dir, int adjust_spacing, halfword p /*, halfword s */ ) { @@ -916,9 +914,9 @@ compute_break_width(int break_type, int line_break_dir, int pdf_adjust_spacing, path, as we are talking about the breaking on {\it this} position. */ - sub_from_widths(vlink_no_break(p), line_break_dir, pdf_adjust_spacing, + sub_from_widths(vlink_no_break(p), line_break_dir, adjust_spacing, break_width); - add_to_widths(vlink_post_break(p), line_break_dir, pdf_adjust_spacing, + add_to_widths(vlink_post_break(p), line_break_dir, adjust_spacing, break_width); do_one_seven_eight(add_disc_width_to_break_width); if (vlink_post_break(p) == null) { @@ -1084,11 +1082,11 @@ static void ext_try_break(int pi, quarterword break_type, int line_break_dir, - int pdf_adjust_spacing, + int adjust_spacing, int par_shape_ptr, int adj_demerits, int tracing_paragraphs, - int pdf_protrude_chars, + int protrude_chars, int line_penalty, int last_line_fit, int double_hyphen_demerits, @@ -1166,7 +1164,7 @@ ext_try_break(int pi, no_break_yet = false; do_all_eight(set_break_width_to_background); compute_break_width(break_type, line_break_dir, - pdf_adjust_spacing, cur_p); + adjust_spacing, cur_p); } /* Insert a delta node to prepare for breaks at |cur_p|; */ /* We use the fact that |type(active)<>delta_node|. */ @@ -1242,7 +1240,7 @@ ext_try_break(int pi, minimum_demerits = awful_bad; /* Insert a delta node to prepare for the next active node; */ /* When the following code is performed, we will have just inserted at - least one active node before |r|, so |type(prev_r)<>delta_node|. + least one active node before |r|, so |type(prev_r)<>delta_node|. */ if (r != active) { q = new_node(delta_node, 0); @@ -1292,7 +1290,7 @@ ext_try_break(int pi, else shortfall -= passive_last_left_box_width(break_node(r)); shortfall -= internal_right_box_width; - if (pdf_protrude_chars > 1) { + if (protrude_chars > 1) { halfword l1, o; l1 = (break_node(r) == null) ? first_p : cur_break(break_node(r)); if (cur_p == null) { @@ -1305,7 +1303,7 @@ ext_try_break(int pi, to get the last character as |pre_break| from either the |pre_break| list (if the previous INIT disc was taken), or the |no_break| (sic) list (if the previous INIT disc was not taken) - + BUT: the last characters (hyphenation character) if these two list should always be the same anyway, so we just look at |pre_break|. @@ -1328,10 +1326,10 @@ ext_try_break(int pi, } shortfall += (left_pw(l1) + right_pw(o)); } - if ((shortfall != 0) && (pdf_adjust_spacing > 1)) { + if ((shortfall != 0) && (adjust_spacing > 1)) { margin_kern_stretch = 0; margin_kern_shrink = 0; - if (pdf_protrude_chars > 1) { + if (protrude_chars > 1) { /* Calculate variations of marginal kerns; */ lp = last_leftmost_char; rp = last_rightmost_char; @@ -1632,12 +1630,14 @@ ext_do_line_break(int paragraph_dir, int tolerance, scaled emergency_stretch, int looseness, + /* int hyphen_penalty, int ex_hyphen_penalty, - int pdf_adjust_spacing, + */ + int adjust_spacing, halfword par_shape_ptr, int adj_demerits, - int pdf_protrude_chars, + int protrude_chars, int line_penalty, int last_line_fit, int double_hyphen_demerits, @@ -1647,10 +1647,6 @@ ext_do_line_break(int paragraph_dir, int hang_after, halfword left_skip, halfword right_skip, - int pdf_each_line_height, - int pdf_each_line_depth, - int pdf_first_line_height, - int pdf_last_line_depth, halfword inter_line_penalties_ptr, int inter_line_penalty, int club_penalty, @@ -1658,7 +1654,7 @@ ext_do_line_break(int paragraph_dir, halfword widow_penalties_ptr, int widow_penalty, int broken_penalty, - halfword final_par_glue, halfword pdf_ignored_dimen) + halfword final_par_glue) { /* DONE,DONE1,DONE2,DONE3,DONE4,DONE5,CONTINUE; */ halfword cur_p, q, r, s; /* miscellaneous nodes of temporary interest */ @@ -1670,7 +1666,7 @@ ext_do_line_break(int paragraph_dir, minimal_demerits[decent_fit] = awful_bad; minimal_demerits[loose_fit] = awful_bad; minimal_demerits[very_loose_fit] = awful_bad; - + /* We compute the values of |easy_line| and the other local variables relating to line length when the |line_break| procedure is initializing itself. */ if (par_shape_ptr == null) { @@ -1727,7 +1723,7 @@ ext_do_line_break(int paragraph_dir, background[2 + stretch_order(q)] = stretch(q); background[2 + stretch_order(r)] += stretch(r); background[7] = shrink(q) + shrink(r); - if (pdf_adjust_spacing > 1) { + if (adjust_spacing > 1) { background[8] = 0; background[9] = 0; max_stretch_ratio = -1; @@ -1843,7 +1839,7 @@ ext_do_line_break(int paragraph_dir, */ active_width[1] += pack_width(line_break_dir, dir_TRT, cur_p, true); - if ((pdf_adjust_spacing > 1) && check_expand_pars(font(cur_p))) { + if ((adjust_spacing > 1) && check_expand_pars(font(cur_p))) { set_prev_char_p(cur_p); add_char_stretch(active_width[8], cur_p); add_char_shrink(active_width[9], cur_p); @@ -1852,7 +1848,7 @@ ext_do_line_break(int paragraph_dir, while (cur_p == null && nest_index > 0) { cur_p = nest_stack[--nest_index]; #ifdef DEBUG - fprintf(stderr,"Node Pop %d [%d]\n",nest_index,(int)cur_p); + fprintf(stderr,"Node Pop %d [%d]\n",nest_index,(int)cur_p); #endif } } @@ -1913,12 +1909,12 @@ ext_do_line_break(int paragraph_dir, halfword prev_p = alink(cur_p); if (prev_p != temp_head && (is_char_node(prev_p) || - precedes_break(prev_p) || + precedes_break(prev_p) || ((type(prev_p) == kern_node) && (subtype(prev_p) != explicit)))) { - ext_try_break(0, unhyphenated_node, line_break_dir, pdf_adjust_spacing, + ext_try_break(0, unhyphenated_node, line_break_dir, adjust_spacing, par_shape_ptr, adj_demerits, - tracing_paragraphs, pdf_protrude_chars, + tracing_paragraphs, protrude_chars, line_penalty, last_line_fit, double_hyphen_demerits, final_hyphen_demerits, first_p, cur_p); @@ -1936,7 +1932,7 @@ ext_do_line_break(int paragraph_dir, kern_break(); } else { active_width[1] += width(cur_p); - if ((pdf_adjust_spacing > 1) && (subtype(cur_p) == normal)) { + if ((adjust_spacing > 1) && (subtype(cur_p) == normal)) { add_kern_stretch(active_width[8], cur_p); add_kern_shrink(active_width[9], cur_p); } @@ -1954,33 +1950,39 @@ ext_do_line_break(int paragraph_dir, automatic disc nodes. Of better, we need to treat discretionaries and explicit hyphens always, even in the first pass (HH). */ if (second_pass || subtype(cur_p) <= automatic_disc) { + /* int actual_penalty = hyphen_penalty; - if (subtype(cur_p) == automatic_disc) + if (disc_penalty(cur_p) != 0) { + actual_penalty = (int) disc_penalty(cur_p); + } else if (subtype(cur_p) == automatic_disc) { actual_penalty = ex_hyphen_penalty; + } + */ + int actual_penalty = (int) disc_penalty(cur_p); s = vlink_pre_break(cur_p); do_one_seven_eight(reset_disc_width); if (s == null) { /* trivial pre-break */ ext_try_break(actual_penalty, hyphenated_node, - line_break_dir, pdf_adjust_spacing, + line_break_dir, adjust_spacing, par_shape_ptr, adj_demerits, - tracing_paragraphs, pdf_protrude_chars, + tracing_paragraphs, protrude_chars, line_penalty, last_line_fit, double_hyphen_demerits, final_hyphen_demerits, first_p, cur_p); } else { - add_to_widths(s, line_break_dir, pdf_adjust_spacing, + add_to_widths(s, line_break_dir, adjust_spacing, disc_width); do_one_seven_eight(add_disc_width_to_active_width); ext_try_break(actual_penalty, hyphenated_node, - line_break_dir, pdf_adjust_spacing, + line_break_dir, adjust_spacing, par_shape_ptr, adj_demerits, - tracing_paragraphs, pdf_protrude_chars, + tracing_paragraphs, protrude_chars, line_penalty, last_line_fit, double_hyphen_demerits, final_hyphen_demerits, first_p, cur_p); if (subtype(cur_p) == init_disc) { /* we should at two break points after the one we - added above: + added above: \item1 which does a possible break in INIT's |post_break| \item2 which means the |no_break| actually was broken just a character later */ @@ -1988,13 +1990,13 @@ ext_do_line_break(int paragraph_dir, assert(type(vlink(cur_p)) == disc_node && subtype(vlink(cur_p)) == select_disc); s = vlink_pre_break(vlink(cur_p)); - add_to_widths(s, line_break_dir, pdf_adjust_spacing, + add_to_widths(s, line_break_dir, adjust_spacing, disc_width); ext_try_break(actual_penalty, hyphenated_node, - line_break_dir, pdf_adjust_spacing, + line_break_dir, adjust_spacing, par_shape_ptr, adj_demerits, tracing_paragraphs, - pdf_protrude_chars, line_penalty, + protrude_chars, line_penalty, last_line_fit, double_hyphen_demerits, final_hyphen_demerits, first_p, vlink(cur_p)); @@ -2006,13 +2008,13 @@ ext_do_line_break(int paragraph_dir, do_one_seven_eight(reset_disc_width); /* add select |no_break| to |active_width| */ s = vlink_no_break(vlink(cur_p)); - add_to_widths(s, line_break_dir, pdf_adjust_spacing, + add_to_widths(s, line_break_dir, adjust_spacing, disc_width); ext_try_break(actual_penalty, hyphenated_node, - line_break_dir, pdf_adjust_spacing, + line_break_dir, adjust_spacing, par_shape_ptr, adj_demerits, tracing_paragraphs, - pdf_protrude_chars, line_penalty, + protrude_chars, line_penalty, last_line_fit, double_hyphen_demerits, final_hyphen_demerits, first_p, vlink(cur_p)); @@ -2022,7 +2024,7 @@ ext_do_line_break(int paragraph_dir, } } s = vlink_no_break(cur_p); - add_to_widths(s, line_break_dir, pdf_adjust_spacing, + add_to_widths(s, line_break_dir, adjust_spacing, active_width); break; case math_node: @@ -2031,8 +2033,8 @@ ext_do_line_break(int paragraph_dir, break; case penalty_node: ext_try_break(penalty(cur_p), unhyphenated_node, line_break_dir, - pdf_adjust_spacing, par_shape_ptr, adj_demerits, - tracing_paragraphs, pdf_protrude_chars, + adjust_spacing, par_shape_ptr, adj_demerits, + tracing_paragraphs, protrude_chars, line_penalty, last_line_fit, double_hyphen_demerits, final_hyphen_demerits, first_p, cur_p); @@ -2072,8 +2074,8 @@ ext_do_line_break(int paragraph_dir, */ ext_try_break(eject_penalty, hyphenated_node, line_break_dir, - pdf_adjust_spacing, par_shape_ptr, adj_demerits, - tracing_paragraphs, pdf_protrude_chars, line_penalty, + adjust_spacing, par_shape_ptr, adj_demerits, + tracing_paragraphs, protrude_chars, line_penalty, last_line_fit, double_hyphen_demerits, final_hyphen_demerits, first_p, cur_p); if (vlink(active) != active) { @@ -2180,13 +2182,9 @@ ext_do_line_break(int paragraph_dir, ext_post_line_break(paragraph_dir, right_skip, left_skip, - pdf_protrude_chars, + protrude_chars, par_shape_ptr, - pdf_adjust_spacing, - pdf_each_line_height, - pdf_each_line_depth, - pdf_first_line_height, - pdf_last_line_depth, + adjust_spacing, inter_line_penalties_ptr, inter_line_penalty, club_penalty, @@ -2198,15 +2196,14 @@ ext_do_line_break(int paragraph_dir, best_bet, last_special_line, second_width, - second_indent, first_width, first_indent, best_line, - pdf_ignored_dimen); + second_indent, first_width, first_indent, best_line); /* /Break the paragraph at the chosen... */ /* Clean up the memory by removing the break nodes; */ clean_up_the_memory(); } @ @c -void get_linebreak_info (int *f, int *a) +void get_linebreak_info (int *f, int *a) { *f = fewest_demerits; *a = actual_looseness; diff --git a/Build/source/texk/web2c/luatexdir/tex/mainbody.w b/Build/source/texk/web2c/luatexdir/tex/mainbody.w index a98bd74a9e0..030e58024f3 100644 --- a/Build/source/texk/web2c/luatexdir/tex/mainbody.w +++ b/Build/source/texk/web2c/luatexdir/tex/mainbody.w @@ -446,8 +446,6 @@ void main_body(void) else buffer[ilimit] = (packed_ASCII_code) int_par(end_line_char_code); fix_date_and_time(); - /*if (ini_version)*/ - /* make_pdftex_banner();*/ random_seed = (microseconds * 1000) + (epochseconds % 1000000); init_randoms(random_seed); initialize_math(); diff --git a/Build/source/texk/web2c/luatexdir/tex/maincontrol.w b/Build/source/texk/web2c/luatexdir/tex/maincontrol.w index e9139dbcbf0..e78220d5cb8 100644 --- a/Build/source/texk/web2c/luatexdir/tex/maincontrol.w +++ b/Build/source/texk/web2c/luatexdir/tex/maincontrol.w @@ -49,13 +49,8 @@ #define err_help equiv(err_help_loc) #define text_direction int_par(text_direction_code) #define every_par equiv(every_par_loc) -#define pdf_ignored_dimen dimen_par(pdf_ignored_dimen_code) #define par_direction int_par(par_direction_code) -#define pdf_first_line_height dimen_par(pdf_first_line_height_code) -#define pdf_last_line_depth dimen_par(pdf_last_line_depth_code) -#define pdf_each_line_height dimen_par(pdf_each_line_height_code) -#define pdf_each_line_depth dimen_par(pdf_each_line_depth_code) #define page_left_offset dimen_par(page_left_offset_code) #define page_top_offset dimen_par(page_top_offset_code) #define page_right_offset dimen_par(page_right_offset_code) @@ -332,9 +327,9 @@ static void run_math_char_num (void) { if (cur_chr == 0) mval = scan_mathchar(tex_mathcode); else if (cur_chr == 1) - mval = scan_mathchar(xetex_mathcode); + mval = scan_mathchar(umath_mathcode); else - mval = scan_mathchar(xetexnum_mathcode); + mval = scan_mathchar(umathnum_mathcode); math_char_in_text(mval); } @@ -347,7 +342,7 @@ static void run_math_given (void) { static void run_xmath_given (void) { mathcodeval mval; /* to build up an argument to |set_math_char| */ - mval = mathchar_from_integer(cur_chr, xetex_mathcode); + mval = mathchar_from_integer(cur_chr, umath_mathcode); math_char_in_text(mval); } @@ -364,13 +359,13 @@ is short, since the |scan_rule_spec| routine already does most of what is required; thus, there is no need for a special action procedure. Note that baselineskip calculations are disabled after a rule in vertical -mode, by setting |prev_depth:=pdf_ignored_dimen|. +mode, by setting |prev_depth:=ignore_depth|. @c static void run_rule (void) { tail_append(scan_rule_spec()); if (abs(mode) == vmode) - prev_depth = pdf_ignored_dimen; + prev_depth = ignore_depth; else if (abs(mode) == hmode) space_factor = 1000; } @@ -550,9 +545,9 @@ static void run_math_char_num_mmode (void) { if (cur_chr == 0) mval = scan_mathchar(tex_mathcode); else if (cur_chr == 1) - mval = scan_mathchar(xetex_mathcode); + mval = scan_mathchar(umath_mathcode); else - mval = scan_mathchar(xetexnum_mathcode); + mval = scan_mathchar(umathnum_mathcode); set_math_char(mval); } @@ -565,7 +560,7 @@ static void run_math_given_mmode (void) { static void run_xmath_given_mmode (void) { mathcodeval mval; /* to build up an argument to |set_math_char| */ - mval = mathchar_from_integer(cur_chr, xetex_mathcode); + mval = mathchar_from_integer(cur_chr, umath_mathcode); set_math_char(mval); } @@ -575,7 +570,7 @@ static void run_delim_num (void) { if (cur_chr == 0) mval = scan_delimiter_as_mathchar(tex_mathcode); else - mval = scan_delimiter_as_mathchar(xetex_mathcode); + mval = scan_delimiter_as_mathchar(umath_mathcode); set_math_char(mval); } @@ -586,7 +581,7 @@ static void run_vcenter (void) { normal_paragraph(); push_nest(); mode = -vmode; - prev_depth = pdf_ignored_dimen; + prev_depth = ignore_depth; if (every_vbox != null) begin_token_list(every_vbox, every_vbox_text); } @@ -1550,7 +1545,7 @@ void begin_insert_or_adjust(void) normal_paragraph(); push_nest(); mode = -vmode; - prev_depth = pdf_ignored_dimen; + prev_depth = ignore_depth; } @@ -1757,6 +1752,7 @@ void append_discretionary(void) tail_append(new_disc()); subtype(tail) = (quarterword) cur_chr; if (cur_chr == explicit_disc) { + /* \- */ c = get_pre_hyphen_char(cur_lang); if (c != 0) { vlink(pre_break(tail)) = new_char(equiv(cur_font_loc), c); @@ -1769,7 +1765,9 @@ void append_discretionary(void) alink(vlink(post_break(tail))) = post_break(tail); tlink(post_break(tail)) = vlink(post_break(tail)); } + disc_penalty(tail) = int_par(ex_hyphen_penalty_code); } else { + /* \discretionary */ incr(save_ptr); set_saved_record(-1, saved_disc, 0, 0); new_save_level(disc_group); @@ -1777,6 +1775,7 @@ void append_discretionary(void) push_nest(); mode = -hmode; space_factor = 1000; + /* already preset: disc_penalty(tail) = int_par(hyphen_penalty_code); */ } } @@ -2250,14 +2249,14 @@ void prefixed_command(void) define(p, math_given_cmd, cur_val); break; case xmath_char_def_code: - mval = scan_mathchar(xetex_mathcode); + mval = scan_mathchar(umath_mathcode); cur_val = (mval.class_value + (8 * mval.family_value)) * (65536 * 32) + mval.character_value; define(p, xmath_given_cmd, cur_val); break; case umath_char_def_code: - mval = scan_mathchar(xetexnum_mathcode); + mval = scan_mathchar(umathnum_mathcode); cur_val = (mval.class_value + (8 * mval.family_value)) * (65536 * 32) + mval.character_value; @@ -2499,13 +2498,13 @@ void prefixed_command(void) else cur_val1 = cur_level; if (cur_chr == math_code_base) - scan_extdef_math_code(cur_val1, xetex_mathcode); + scan_extdef_math_code(cur_val1, umath_mathcode); else if (cur_chr == math_code_base + 1) - scan_extdef_math_code(cur_val1, xetexnum_mathcode); + scan_extdef_math_code(cur_val1, umathnum_mathcode); else if (cur_chr == del_code_base) - scan_extdef_del_code(cur_val1, xetex_mathcode); + scan_extdef_del_code(cur_val1, umath_mathcode); else if (cur_chr == del_code_base + 1) - scan_extdef_del_code(cur_val1, xetexnum_mathcode); + scan_extdef_del_code(cur_val1, umathnum_mathcode); break; case def_family_cmd: p = cur_chr; @@ -2655,6 +2654,9 @@ void prefixed_command(void) case 5: new_post_exhyphen_char(); break; + case 6: + new_hyphenation_min(); + break; } break; case assign_font_dimen_cmd: @@ -3583,11 +3585,6 @@ void initialize(void) page_top_offset = one_inch; page_right_offset = one_inch; page_bottom_offset = one_inch; - pdf_ignored_dimen = ignore_depth; - pdf_each_line_height = pdf_ignored_dimen; - pdf_each_line_depth = pdf_ignored_dimen; - pdf_first_line_height = pdf_ignored_dimen; - pdf_last_line_depth = pdf_ignored_dimen; ini_init_primitives(); hash_used = frozen_control_sequence; /* nothing is used */ hash_high = 0; diff --git a/Build/source/texk/web2c/luatexdir/tex/mathcodes.h b/Build/source/texk/web2c/luatexdir/tex/mathcodes.h index 1640d82b989..a2f84eb8411 100644 --- a/Build/source/texk/web2c/luatexdir/tex/mathcodes.h +++ b/Build/source/texk/web2c/luatexdir/tex/mathcodes.h @@ -25,8 +25,8 @@ # define no_mathcode 0 /* this is a flag for |scan_delimiter| */ # define tex_mathcode 8 -# define xetex_mathcode 21 -# define xetexnum_mathcode 22 +# define umath_mathcode 21 +# define umathnum_mathcode 22 typedef struct mathcodeval { int class_value; diff --git a/Build/source/texk/web2c/luatexdir/tex/mathcodes.w b/Build/source/texk/web2c/luatexdir/tex/mathcodes.w index b5addc7d6c9..ac26fc75d9d 100644 --- a/Build/source/texk/web2c/luatexdir/tex/mathcodes.w +++ b/Build/source/texk/web2c/luatexdir/tex/mathcodes.w @@ -77,14 +77,14 @@ static int delcode_heapptr = 0; @ @c void show_mathcode_value(mathcodeval c) { - if (c.origin_value == xetex_mathcode) { + if (c.origin_value == umath_mathcode) { print_char('"'); print_hex_digit(c.class_value); print_char('"'); two_hex(c.family_value); print_char('"'); six_hex(c.character_value); - } else if (c.origin_value == xetexnum_mathcode) { + } else if (c.origin_value == umathnum_mathcode) { int m; m = (c.class_value + (c.family_value * 8)) * 2097152 + c.character_value; @@ -110,9 +110,9 @@ void show_mathcode_value(mathcodeval c) static void show_mathcode(int n) { mathcodeval c = get_math_code(n); - if (c.origin_value == xetex_mathcode) { + if (c.origin_value == umath_mathcode) { tprint_esc("Umathcode"); - } else if (c.origin_value == xetexnum_mathcode) { + } else if (c.origin_value == umathnum_mathcode) { tprint_esc("Umathcodenum"); } else { tprint_esc("mathcode"); @@ -188,7 +188,7 @@ mathcodeval get_math_code(int n) mathcodeval d; d.class_value = 0; d.family_value = 0; - d.origin_value = (n < 256 ? tex_mathcode : xetex_mathcode); + d.origin_value = (n < 256 ? tex_mathcode : umath_mathcode); d.character_value = n; return d; } else { @@ -278,9 +278,9 @@ static void show_delcode(int n) c = get_del_code(n); if (c.origin_value == tex_mathcode) { tprint_esc("delcode"); - } else if (c.origin_value == xetex_mathcode) { + } else if (c.origin_value == umath_mathcode) { tprint_esc("Udelcode"); - } else if (c.origin_value == xetexnum_mathcode) { + } else if (c.origin_value == umathnum_mathcode) { tprint_esc("Udelcodenum"); } print_int(n); @@ -295,11 +295,11 @@ static void show_delcode(int n) two_hex(c.small_character_value); print_hex_digit(c.large_family_value); two_hex(c.large_character_value); - } else if (c.origin_value == xetex_mathcode) { + } else if (c.origin_value == umath_mathcode) { print_char('"'); two_hex(c.small_family_value); six_hex(c.small_character_value); - } else if (c.origin_value == xetexnum_mathcode) { + } else if (c.origin_value == umathnum_mathcode) { int m; m = c.small_family_value * 2097152 + c.small_character_value; print_int(m); diff --git a/Build/source/texk/web2c/luatexdir/tex/mlist.w b/Build/source/texk/web2c/luatexdir/tex/mlist.w index 9ae2607265c..7684dd0d171 100644 --- a/Build/source/texk/web2c/luatexdir/tex/mlist.w +++ b/Build/source/texk/web2c/luatexdir/tex/mlist.w @@ -3350,14 +3350,14 @@ static void mlist_to_hlist(pointer mlist, boolean penalties, int cur_style) goto CHECK_DIMENSIONS; break; case radical_noad: - if (subtype(q) == 4) - make_under_delimiter(q, cur_style); + if (subtype(q) == 6) + make_delimiter_over(q, cur_style); else if (subtype(q) == 5) - make_over_delimiter(q, cur_style); - else if (subtype(q) == 6) make_delimiter_under(q, cur_style); - else if (subtype(q) == 7) - make_delimiter_over(q, cur_style); + else if (subtype(q) == 4) + make_over_delimiter(q, cur_style); + else if (subtype(q) == 3) + make_under_delimiter(q, cur_style); else make_radical(q, cur_style); break; diff --git a/Build/source/texk/web2c/luatexdir/tex/nesting.w b/Build/source/texk/web2c/luatexdir/tex/nesting.w index ed27600bd5f..045bf78febe 100644 --- a/Build/source/texk/web2c/luatexdir/tex/nesting.w +++ b/Build/source/texk/web2c/luatexdir/tex/nesting.w @@ -25,7 +25,6 @@ @ these are for |show_activities| @c #define page_goal page_so_far[0] -#define pdf_ignored_dimen dimen_par(pdf_ignored_dimen_code) #define count(A) eqtb[count_base+(A)].cint @@ -407,7 +406,7 @@ void show_activities(void) switch (abs(m) / (max_command_cmd + 1)) { case 0: tprint_nl("prevdepth "); - if (nest[p].prev_depth_field <= pdf_ignored_dimen) + if (nest[p].prev_depth_field <= ignore_depth) tprint("ignored"); else print_scaled(nest[p].prev_depth_field); diff --git a/Build/source/texk/web2c/luatexdir/tex/packaging.w b/Build/source/texk/web2c/luatexdir/tex/packaging.w index edc22b3e824..731e7e1524a 100644 --- a/Build/source/texk/web2c/luatexdir/tex/packaging.w +++ b/Build/source/texk/web2c/luatexdir/tex/packaging.w @@ -1269,7 +1269,7 @@ void append_to_vlist(halfword b) { scaled d; /* deficiency of space between baselines */ halfword p; /* a new glue node */ - if (prev_depth > dimen_par(pdf_ignored_dimen_code)) { + if (prev_depth > ignore_depth) { if ((type(b) == hlist_node) && is_mirrored(box_dir(b))) { d = width(glue_par(baseline_skip_code)) - prev_depth - depth(b); } else { @@ -1756,7 +1756,7 @@ void begin_box(int box_context) push_nest(); cur_list.mode_field = -k; if (k == vmode) { - prev_depth = dimen_par(pdf_ignored_dimen_code); + prev_depth = ignore_depth; if (every_vbox != null) begin_token_list(every_vbox, every_vbox_text); } else { diff --git a/Build/source/texk/web2c/luatexdir/tex/postlinebreak.h b/Build/source/texk/web2c/luatexdir/tex/postlinebreak.h index e4a492a8ca5..cd90e1f0bc5 100644 --- a/Build/source/texk/web2c/luatexdir/tex/postlinebreak.h +++ b/Build/source/texk/web2c/luatexdir/tex/postlinebreak.h @@ -32,13 +32,9 @@ void ext_post_line_break(int paragraph_dir, int right_skip, int left_skip, - int pdf_protrude_chars, + int protrude_chars, halfword par_shape_ptr, - int pdf_adjust_spacing, - int pdf_each_line_height, - int pdf_each_line_depth, - int pdf_first_line_height, - int pdf_last_line_depth, + int adjust_spacing, halfword inter_line_penalties_ptr, int inter_line_penalty, int club_penalty, @@ -52,7 +48,6 @@ void ext_post_line_break(int paragraph_dir, scaled second_width, scaled second_indent, scaled first_width, - scaled first_indent, halfword best_line, - halfword pdf_ignored_dimen); + scaled first_indent, halfword best_line); #endif diff --git a/Build/source/texk/web2c/luatexdir/tex/postlinebreak.w b/Build/source/texk/web2c/luatexdir/tex/postlinebreak.w index 2fa1b269fc9..423164ef3d3 100644 --- a/Build/source/texk/web2c/luatexdir/tex/postlinebreak.w +++ b/Build/source/texk/web2c/luatexdir/tex/postlinebreak.w @@ -58,13 +58,9 @@ and begin direction instructions at the beginnings of lines. void ext_post_line_break(int paragraph_dir, int right_skip, int left_skip, - int pdf_protrude_chars, + int protrude_chars, halfword par_shape_ptr, - int pdf_adjust_spacing, - int pdf_each_line_height, - int pdf_each_line_depth, - int pdf_first_line_height, - int pdf_last_line_depth, + int adjust_spacing, halfword inter_line_penalties_ptr, int inter_line_penalty, int club_penalty, @@ -78,8 +74,7 @@ void ext_post_line_break(int paragraph_dir, scaled second_width, scaled second_indent, scaled first_width, - scaled first_indent, halfword best_line, - halfword pdf_ignored_dimen) + scaled first_indent, halfword best_line) { boolean have_directional = true; @@ -304,7 +299,7 @@ void ext_post_line_break(int paragraph_dir, has been changed to the last node of the |pre_break| list */ /* If the par ends with a \break command, the last line is utterly empty. That is the case of |q==temp_head| */ - if (q != temp_head && pdf_protrude_chars > 0) { + if (q != temp_head && protrude_chars > 0) { halfword p, ptmp; if (disc_break && (is_char_node(q) || (type(q) != disc_node))) { p = q; /* |q| has been reset to the last node of |pre_break| */ @@ -372,7 +367,7 @@ void ext_post_line_break(int paragraph_dir, } } /*at this point |q| is the leftmost node; all discardable nodes have been discarded */ - if (pdf_protrude_chars > 0) { + if (protrude_chars > 0) { halfword p; p = q; p = find_protchar_left(p, false); /* no more discardables */ @@ -415,7 +410,7 @@ void ext_post_line_break(int paragraph_dir, } adjust_tail = adjust_head; pre_adjust_tail = pre_adjust_head; - if (pdf_adjust_spacing > 0) { + if (adjust_spacing > 0) { just_box = hpack(q, cur_width, cal_expand_ratio, paragraph_dir); } else { just_box = hpack(q, cur_width, exactly, paragraph_dir); @@ -424,19 +419,6 @@ void ext_post_line_break(int paragraph_dir, subtype(just_box) = HLIST_SUBTYPE_LINE; /* /Call the packaging subroutine, setting |just_box| to the justified box; */ - /* Append the new box to the current vertical list, followed by the list of - special nodes taken out of the box by the packager; */ - if (pdf_each_line_height != pdf_ignored_dimen) - height(just_box) = pdf_each_line_height; - if (pdf_each_line_depth != pdf_ignored_dimen) - depth(just_box) = pdf_each_line_depth; - if ((pdf_first_line_height != pdf_ignored_dimen) - && (cur_line == cur_list.pg_field + 1)) - height(just_box) = pdf_first_line_height; - if ((pdf_last_line_depth != pdf_ignored_dimen) - && (cur_line + 1 == best_line)) - depth(just_box) = pdf_last_line_depth; - if ((vlink(contrib_head) != null)) if (!output_active) lua_node_filter_s(buildpage_filter_callback, lua_key_index(pre_box)); diff --git a/Build/source/texk/web2c/luatexdir/tex/primitive.h b/Build/source/texk/web2c/luatexdir/tex/primitive.h index cca6fe9de08..36df9c9be82 100644 --- a/Build/source/texk/web2c/luatexdir/tex/primitive.h +++ b/Build/source/texk/web2c/luatexdir/tex/primitive.h @@ -24,15 +24,14 @@ /* This enum is a list of origins for primitive commands */ typedef enum { - tex_command = 1, - etex_command = 2, - aleph_command = 4, - omega_command = 8, - pdftex_command = 16, - luatex_command = 32, - core_command = 64, - no_command = 128, - umath_command = 256, + /* Can be modified as suggested ?*/ + tex_command = 1, /* 1 */ + etex_command = 2, /* 2 */ + pdftex_command = 16,/* 4 */ + luatex_command = 32,/* 8 */ + core_command = 64, /* 16 */ + no_command = 128, /* 32 */ + umath_command = 256,/* 64 */ } command_origin; # define hash_size 65536 /* maximum number of control sequences; it should be at most about |(fix_mem_max-fix_mem_min)/10| */ @@ -74,8 +73,6 @@ extern void undump_primitives(void); # define primitive_tex(a,b,c,d) primitive((a),(b),(c),(d),tex_command) # define primitive_etex(a,b,c,d) primitive((a),(b),(c),(d),etex_command) -# define primitive_aleph(a,b,c,d) primitive((a),(b),(c),(d),aleph_command) -# define primitive_omega(a,b,c,d) primitive((a),(b),(c),(d),omega_command) # define primitive_pdftex(a,b,c,d) primitive((a),(b),(c),(d),pdftex_command) # define primitive_luatex(a,b,c,d) primitive((a),(b),(c),(d),luatex_command) # define primitive_umath(a,b,c,d) primitive((a),(b),(c),(d),umath_command) diff --git a/Build/source/texk/web2c/luatexdir/tex/primitive.w b/Build/source/texk/web2c/luatexdir/tex/primitive.w index e343a0ffd07..432bde28878 100644 --- a/Build/source/texk/web2c/luatexdir/tex/primitive.w +++ b/Build/source/texk/web2c/luatexdir/tex/primitive.w @@ -560,7 +560,7 @@ void print_cmd_chr(quarterword cmd, halfword chr_code) break; case xmath_given_cmd: tprint_esc("Umathchar"); - show_mathcode_value(mathchar_from_integer(chr_code, xetex_mathcode)); + show_mathcode_value(mathchar_from_integer(chr_code, umath_mathcode)); break; case set_font_cmd: tprint("select font "); diff --git a/Build/source/texk/web2c/luatexdir/tex/scanning.w b/Build/source/texk/web2c/luatexdir/tex/scanning.w index 337c19a8276..1adeb5770fa 100644 --- a/Build/source/texk/web2c/luatexdir/tex/scanning.w +++ b/Build/source/texk/web2c/luatexdir/tex/scanning.w @@ -421,9 +421,6 @@ static boolean short_scan_something_internal(int cmd, int chr, int level, case badness_code: cur_val = last_badness; break; - case pdftex_version_code: - cur_val = pdftex_version; - break; case luatex_version_code: cur_val = get_luatexversion(); break; @@ -442,10 +439,10 @@ static boolean short_scan_something_internal(int cmd, int chr, int level, case pdf_last_annot_code: cur_val = pdf_last_annot; break; - case pdf_last_x_pos_code: + case last_x_pos_code: cur_val = pdf_last_pos.h; break; - case pdf_last_y_pos_code: + case last_y_pos_code: cur_val = pdf_last_pos.v; break; case pdf_retval_code: diff --git a/Build/source/texk/web2c/luatexdir/tex/texmath.w b/Build/source/texk/web2c/luatexdir/tex/texmath.w index 4ee213ec2b0..04152ff2999 100644 --- a/Build/source/texk/web2c/luatexdir/tex/texmath.w +++ b/Build/source/texk/web2c/luatexdir/tex/texmath.w @@ -689,16 +689,17 @@ void display_normal_noad(pointer p) break; } break; - case radical_noad: - if (subtype(p) == 7) + + case radical_noad: + if (subtype(p) == 6) tprint_esc("Udelimiterover"); - else if (subtype(p) == 6) - tprint_esc("Udelimiterunder"); else if (subtype(p) == 5) - tprint_esc("Uoverdelimiter"); + tprint_esc("Udelimiterunder"); else if (subtype(p) == 4) - tprint_esc("Uunderdelimiter"); + tprint_esc("Uoverdelimiter"); else if (subtype(p) == 3) + tprint_esc("Uunderdelimiter"); + else if (subtype(p) == 2) tprint_esc("Uroot"); else tprint_esc("radical"); @@ -1059,7 +1060,7 @@ static delcodeval do_scan_extdef_del_code(int extcode, boolean doclass) mschr = (cur_val % 0x100000) / 0x1000; mlfam = (cur_val & 0xFFF) / 0x100; mlchr = (cur_val % 0x100); - } else if (extcode == xetex_mathcode) { /* \.{\\Udelcode} */ + } else if (extcode == umath_mathcode) { /* \.{\\Udelcode} */ /* <0-7>,<0-0xFF>,<0-0x10FFFF> or <0-0xFF>,<0-0x10FFFF> */ if (doclass) { scan_int(); @@ -1076,13 +1077,13 @@ static delcodeval do_scan_extdef_del_code(int extcode, boolean doclass) } mlfam = 0; mlchr = 0; - } else if (extcode == xetexnum_mathcode) { /* \.{\\Udelcodenum} */ + } else if (extcode == umathnum_mathcode) { /* \.{\\Udelcodenum} */ /* "FF<21bits> */ /* the largest numeric value is $2^29-1$, but the top of bit 21 can't be used as it contains invalid USV's */ if (doclass) { /* such a primitive doesn't exist */ - confusion("xetexnum_mathcode"); + confusion("umathnum_mathcode"); } scan_int(); msfam = (cur_val / 0x200000); @@ -1146,7 +1147,7 @@ mathcodeval scan_mathchar(int extcode) mcls = (cur_val / 0x1000); mfam = ((cur_val % 0x1000) / 0x100); mchr = (cur_val % 0x100); - } else if (extcode == xetex_mathcode) { + } else if (extcode == umath_mathcode) { /* <0-0x7> <0-0xFF> <0-0x10FFFF> */ scan_int(); mcls = cur_val; @@ -1160,7 +1161,7 @@ mathcodeval scan_mathchar(int extcode) mfam = 0; mcls = 0; } - } else if (extcode == xetexnum_mathcode) { + } else if (extcode == umathnum_mathcode) { /* "FFT<21bits> */ /* the largest numeric value is $2^32-1$, but the top of bit 21 can't be used as it contains invalid USV's @@ -1281,9 +1282,9 @@ int scan_math(pointer p, int mstyle) if (cur_chr == 0) mval = scan_mathchar(tex_mathcode); else if (cur_chr == 1) - mval = scan_mathchar(xetex_mathcode); + mval = scan_mathchar(umath_mathcode); else if (cur_chr == 2) - mval = scan_mathchar(xetexnum_mathcode); + mval = scan_mathchar(umathnum_mathcode); else confusion("scan_math"); break; @@ -1291,13 +1292,13 @@ int scan_math(pointer p, int mstyle) mval = mathchar_from_integer(cur_chr, tex_mathcode); break; case xmath_given_cmd: - mval = mathchar_from_integer(cur_chr, xetex_mathcode); + mval = mathchar_from_integer(cur_chr, umath_mathcode); break; case delim_num_cmd: if (cur_chr == 0) mval = scan_delimiter_as_mathchar(tex_mathcode); else if (cur_chr == 1) - mval = scan_delimiter_as_mathchar(xetex_mathcode); + mval = scan_delimiter_as_mathchar(umath_mathcode); else confusion("scan_math"); break; @@ -1440,8 +1441,8 @@ static void scan_delimiter(pointer p, int r) delcodeval dval = { 0, 0, 0, 0, 0, 0 }; if (r == tex_mathcode) { /* \.{\\radical} */ dval = do_scan_extdef_del_code(tex_mathcode, true); - } else if (r == xetex_mathcode) { /* \.{\\Uradical} */ - dval = do_scan_extdef_del_code(xetex_mathcode, false); + } else if (r == umath_mathcode) { /* \.{\\Uradical} */ + dval = do_scan_extdef_del_code(umath_mathcode, false); } else if (r == no_mathcode) { get_next_nb_nr(); switch (cur_cmd) { @@ -1453,7 +1454,7 @@ static void scan_delimiter(pointer p, int r) if (cur_chr == 0) /* \.{\\delimiter} */ dval = do_scan_extdef_del_code(tex_mathcode, true); else if (cur_chr == 1) /* \.{\\Udelimiter} */ - dval = do_scan_extdef_del_code(xetex_mathcode, true); + dval = do_scan_extdef_del_code(umath_mathcode, true); else confusion("scan_delimiter1"); break; @@ -1502,17 +1503,17 @@ void math_radical(void) if (chr_code == 0) /* \.{\\radical} */ scan_delimiter(left_delimiter(tail), tex_mathcode); else if (chr_code == 1) /* \.{\\Uradical} */ - scan_delimiter(left_delimiter(tail), xetex_mathcode); + scan_delimiter(left_delimiter(tail), umath_mathcode); else if (chr_code == 2) /* \.{\\Uroot} */ - scan_delimiter(left_delimiter(tail), xetex_mathcode); + scan_delimiter(left_delimiter(tail), umath_mathcode); else if (chr_code == 3) /* \.{\\Uunderdelimiter} */ - scan_delimiter(left_delimiter(tail), xetex_mathcode); + scan_delimiter(left_delimiter(tail), umath_mathcode); else if (chr_code == 4) /* \.{\\Uoverdelimiter} */ - scan_delimiter(left_delimiter(tail), xetex_mathcode); + scan_delimiter(left_delimiter(tail), umath_mathcode); else if (chr_code == 5) /* \.{\\Udelimiterunder} */ - scan_delimiter(left_delimiter(tail), xetex_mathcode); + scan_delimiter(left_delimiter(tail), umath_mathcode); else if (chr_code == 6) /* \.{\\Udelimiterover} */ - scan_delimiter(left_delimiter(tail), xetex_mathcode); + scan_delimiter(left_delimiter(tail), umath_mathcode); else confusion("math_radical"); if (chr_code == 2) { @@ -1554,23 +1555,23 @@ void math_ac(void) } else if (cur_chr == 1) { /* \.{\\Umathaccent} */ if (scan_keyword("fixed")) { subtype(tail) = 1; - t = scan_mathchar(xetex_mathcode); + t = scan_mathchar(umath_mathcode); } else if (scan_keyword("both")) { if (scan_keyword("fixed")) { subtype(tail) = 1; } - t = scan_mathchar(xetex_mathcode); + t = scan_mathchar(umath_mathcode); if (scan_keyword("fixed")) { subtype(tail) += 2; } - b = scan_mathchar(xetex_mathcode); + b = scan_mathchar(umath_mathcode); } else if (scan_keyword("bottom")) { if (scan_keyword("fixed")) { subtype(tail) = 2; } - b = scan_mathchar(xetex_mathcode); + b = scan_mathchar(umath_mathcode); } else { - t = scan_mathchar(xetex_mathcode); + t = scan_mathchar(umath_mathcode); } } else { confusion("math_ac"); diff --git a/Build/source/texk/web2c/luatexdir/tex/texnodes.h b/Build/source/texk/web2c/luatexdir/tex/texnodes.h index 97ad3b0ede9..f73fba1d585 100644 --- a/Build/source/texk/web2c/luatexdir/tex/texnodes.h +++ b/Build/source/texk/web2c/luatexdir/tex/texnodes.h @@ -30,7 +30,7 @@ # define get_character(a) character(a) extern halfword insert_discretionary(halfword t, halfword pre, halfword post, - halfword replace); + halfword replace, int penalty); extern halfword insert_syllable_discretionary(halfword t, lang_variables * lan); extern halfword insert_word_discretionary(halfword t, lang_variables * lan); extern halfword insert_complex_discretionary(halfword t, lang_variables * lan, @@ -151,7 +151,7 @@ typedef enum { pointers are not really needed (8 instead of 10). */ -# define disc_node_size 10 +# define disc_node_size 11 typedef enum { discretionary_disc = 0, @@ -162,13 +162,14 @@ typedef enum { select_disc, /* second of a duo of syllable_discs */ } discretionary_types; -# define pre_break_head(a) ((a)+4) -# define post_break_head(a) ((a)+6) -# define no_break_head(a) ((a)+8) +# define pre_break_head(a) ((a)+5) +# define post_break_head(a) ((a)+7) +# define no_break_head(a) ((a)+9) -# define pre_break(a) vinfo((a)+2) -# define post_break(a) vlink((a)+2) -# define no_break(a) vlink((a)+3) +# define disc_penalty(a) vlink((a)+2) +# define pre_break(a) vinfo((a)+3) +# define post_break(a) vlink((a)+3) +# define no_break(a) vlink((a)+4) # define tlink llink # define vlink_pre_break(a) vlink(pre_break_head(a)) @@ -429,14 +430,16 @@ typedef enum { # define large_fam(A) vinfo((A)+3) /* |fam| for ``large'' delimiter */ # define large_char(A) vlink((A)+3) /* |character| for ``large'' delimiter */ + +/* be careful: must be in sync with whatsit_node_data[] ! (at least) */ typedef enum { open_node = 0, write_node, close_node, special_node, - language_node, - set_language_code, - local_par_node, + /*language_node, OBSOLETE*/ + /*set_language_code, OBSOLETE*/ + local_par_node=6, dir_node, pdf_literal_node, pdf_obj_code, @@ -453,7 +456,7 @@ typedef enum { pdf_thread_node, /* 20 */ pdf_start_thread_node, pdf_end_thread_node, - pdf_save_pos_node, + save_pos_node, pdf_thread_data_node, pdf_link_data_node, pdf_names_code, @@ -462,7 +465,7 @@ typedef enum { pdf_map_file_code, pdf_map_line_code, /* 30 */ pdf_trailer_code, - pdf_font_expand_code, + font_expand_code, set_random_seed_code, pdf_glyph_to_unicode_code, late_lua_node, /* 35 */ @@ -470,7 +473,7 @@ typedef enum { save_cat_code_table_code, init_cat_code_table_code, pdf_colorstack_node, - pdf_setmatrix_node, /* 40 */ + pdf_setmatrix_node, /*40 */ pdf_save_node, pdf_restore_node, cancel_boundary_node, @@ -547,6 +550,9 @@ typedef enum { # define late_lua_name(a) vlink((a)+3) # define late_lua_type(a) subtype((a)+3) +# define save_pos_node_size 3 + + # define local_par_size 6 # define local_pen_inter(a) vinfo((a)+2) @@ -621,7 +627,6 @@ destination |pdf_ann_left| and |pdf_ann_top| are used for some types of destinat # define pdf_end_link_node_size 3 # define pdf_end_thread_node_size 3 -# define pdf_save_pos_node_size 3 # define pdf_colorstack_node_size 4 # define pdf_setmatrix_node_size 3 diff --git a/Build/source/texk/web2c/luatexdir/tex/texnodes.w b/Build/source/texk/web2c/luatexdir/tex/texnodes.w index 04c2c5fee58..f500035bdf8 100644 --- a/Build/source/texk/web2c/luatexdir/tex/texnodes.w +++ b/Build/source/texk/web2c/luatexdir/tex/texnodes.w @@ -78,7 +78,7 @@ const char *node_fields_insert[] = { "attr", "cost", "depth", "height", "spec", "head", NULL }; const char *node_fields_mark[] = { "attr", "class", "mark", NULL }; const char *node_fields_adjust[] = { "attr", "head", NULL }; -const char *node_fields_disc[] = { "attr", "pre", "post", "replace", NULL }; +const char *node_fields_disc[] = { "attr", "pre", "post", "replace", "penalty", NULL }; const char *node_fields_math[] = { "attr", "surround", NULL }; const char *node_fields_glue[] = { "attr", "spec", "leader", NULL }; const char *node_fields_kern[] = { "attr", "kern", "expansion_factor", NULL }; @@ -182,7 +182,7 @@ const char *node_fields_whatsit_pdf_start_thread[] = "named_id", "thread_id", "thread_attr", NULL }; const char *node_fields_whatsit_pdf_end_thread[] = { "attr", NULL }; -const char *node_fields_whatsit_pdf_save_pos[] = { "attr", NULL }; +const char *node_fields_whatsit_save_pos[] = { "attr", NULL }; const char *node_fields_whatsit_late_lua[] = { "attr", "reg", "data", "name", "string", NULL }; const char *node_fields_whatsit_close_lua[] = { "attr", "reg", NULL }; @@ -296,8 +296,8 @@ node_info whatsit_node_data[] = { node_fields_whatsit_pdf_start_thread, "pdf_start_thread"}, {pdf_end_thread_node, pdf_end_thread_node_size, node_fields_whatsit_pdf_end_thread, "pdf_end_thread"}, - {pdf_save_pos_node, pdf_save_pos_node_size, - node_fields_whatsit_pdf_save_pos, "pdf_save_pos"}, + {save_pos_node, save_pos_node_size, + node_fields_whatsit_save_pos, "save_pos"}, {pdf_thread_data_node, pdf_thread_node_size, NULL, "pdf_thread_data"}, {pdf_link_data_node, pdf_annot_node_size, NULL, "pdf_link_data"}, {fake_node, fake_node_size, NULL, fake_node_name}, @@ -1166,7 +1166,7 @@ void flush_node(halfword p) case pdf_refximage_node: case pdf_end_link_node: case pdf_end_thread_node: - case pdf_save_pos_node: + case save_pos_node: case local_par_node: break; @@ -1474,7 +1474,7 @@ void check_node(halfword p) case pdf_refximage_node: case pdf_end_link_node: case pdf_end_thread_node: - case pdf_save_pos_node: + case save_pos_node: case local_par_node: break; default: @@ -2144,8 +2144,8 @@ static halfword new_attribute_node(unsigned int i, int v) type(r) = attribute_node; attribute_id(r) = (halfword) i; attribute_value(r) = v; - /* not used but nicer in print */ - subtype(r) = 0; + /* not used but nicer in print */ + subtype(r) = 0; return r; } @@ -2213,37 +2213,37 @@ void build_attribute_list(halfword b) @ @c -halfword current_attribute_list(void) +halfword current_attribute_list(void) { if (max_used_attr >= 0) { if (attr_list_cache == cache_disabled) { update_attribute_cache(); - } - return attr_list_cache ; + } + return attr_list_cache ; } return null ; } @ @c -void reassign_attribute(halfword n, halfword new) +void reassign_attribute(halfword n, halfword new) { halfword old; old = node_attr(n); if (new == null) { /* there is nothing to assign but we need to check for an old value */ - if (old != null) + if (old != null) delete_attribute_ref(old); /* also nulls attr field of n */ } else if (old == null) { /* nothing is assigned so we just do that now */ assign_attribute_ref(n,new); - } else if (old != new) { + } else if (old != new) { /* something is assigned so we need to clean up and assign then */ delete_attribute_ref(old); assign_attribute_ref(n,new); } /* else: same value so there is no need to assign and change the refcount */ - node_attr(n) = new ; + node_attr(n) = new ; } @@ -2799,8 +2799,8 @@ static void show_whatsit_node(int p) case pdf_end_thread_node: tprint_esc("pdfendthread"); break; - case pdf_save_pos_node: - tprint_esc("pdfsavepos"); + case save_pos_node: + tprint_esc("savepos"); break; case user_defined_node: tprint_esc("whatsit"); @@ -3082,6 +3082,8 @@ void show_node_list(int p) /* The |post_break| list of a discretionary node is indicated by a prefixed `\.{\char'174}' instead of the `\..' before the |pre_break| list. */ tprint_esc("discretionary"); + print_int(disc_penalty(p)); + print_char('|'); if (vlink(no_break(p)) != null) { tprint(" replacing "); node_list_display(vlink(no_break(p))); @@ -3479,6 +3481,7 @@ halfword new_disc(void) { /* creates an empty |disc_node| */ halfword p; /* the new node */ p = new_node(disc_node, 0); + disc_penalty(p) = int_par(hyphen_penalty_code); return p; } diff --git a/Build/source/texk/web2c/luatexdir/tex/textoken.w b/Build/source/texk/web2c/luatexdir/tex/textoken.w index 080f30c2e43..06fffee9c38 100644 --- a/Build/source/texk/web2c/luatexdir/tex/textoken.w +++ b/Build/source/texk/web2c/luatexdir/tex/textoken.w @@ -1641,9 +1641,6 @@ static boolean print_convert_string(halfword c, int i) case etex_code: tprint(eTeX_version_string); break; - case pdftex_revision_code: - tprint(pdftex_revision); - break; case luatex_revision_code: print(get_luatexrevision()); break; @@ -1779,7 +1776,6 @@ void conv_toks(void) case font_id_code: scan_font_ident(); break; - case pdftex_revision_code: case luatex_revision_code: case luatex_date_code: case luatex_banner_code: |