diff --git a/manual/luatex-languages.tex b/manual/luatex-languages.tex index 865ae0b5884c8fc538b446f073b9e7dbdc997fb8..11e8e6c9951f2b72b6217d9b1fe2ae2e4cabed5a 100644 --- a/manual/luatex-languages.tex +++ b/manual/luatex-languages.tex @@ -345,6 +345,25 @@ character|-|handling code have been moved back inline. When \type {\tracingcommands} is on, this is visible because the full word is reported, instead of just the initial character. +Because we tend to make hard codes behaviour configurable two new primitives have +been added: + +\starttyping +\automatichyphenmode +\automatichyphenpenalty +\stoptyping + +The first parameter has the following consequences for automatic discs (the ones +resulting from an \type {\exhyphenchar}: + +\starttabulate[|T||] +\NC 0 \NC assign \type {\exhyphenpenalty} \NC \NR +\NC 1 \NC assign \type {\hyphenpenalty} \NC \NR +\NC 2 \NC assign \type {\automatichyphenpenalty} \NC \NR +\stoptabulate + +other values do what we always did in \LUATEX: insert \type {\exhyphenpenalty}. + \section[patternsexceptions]{Loading patterns and exceptions} The hyphenation algorithm in \LUATEX\ is quite different from the one in \TEX82, diff --git a/manual/luatex.pdf b/manual/luatex.pdf index 23ccd7cb17b7b40b02f320aa8b52cbc8144fdc85..9b609ca963110b20691314ee6fadf866ad56c222 100644 Binary files a/manual/luatex.pdf and b/manual/luatex.pdf differ diff --git a/source/texk/web2c/luatexdir/lang/texlang.w b/source/texk/web2c/luatexdir/lang/texlang.w index cf88928e8d4c4c711297bb4c1ce71bd850c5d93a..c3d1ad203fb754d7b1acdd9968fc446a714eb4be 100644 --- a/source/texk/web2c/luatexdir/lang/texlang.w +++ b/source/texk/web2c/luatexdir/lang/texlang.w @@ -721,6 +721,25 @@ there was not the best idea ever. */ +#define check_automatic_disc(t) \ +switch (automatic_hyphen_mode_par) { \ + case 0: \ + /* we take ex_hyphen_penalty */ \ + disc_penalty(t) = ex_hyphen_penalty_par; \ + break ; \ + case 1: \ + /* we take hyphen_penalty */ \ + disc_penalty(t) = hyphen_penalty_par; \ + break ; \ + case 2: \ + /* we take automatic_hyphen_penalty */ \ + disc_penalty(t) = automatic_hyphen_penalty_par; \ + break ; \ + default: \ + disc_penalty(t) = ex_hyphen_penalty_par; \ + break ; \ +} \ + static halfword find_next_wordstart(halfword r, halfword first_language, halfword strict_bound) { register int l; @@ -776,6 +795,7 @@ static halfword find_next_wordstart(halfword r, halfword first_language, halfwor t = vlink(r) ; if ((start_ok == 0) && (t!=null) && (type(t) == glyph_node) && (character(t) != ex_hyphen_char_par)) { t = compound_word_break(r, char_lang(r)); + check_automatic_disc(t); subtype(t) = automatic_disc; start_ok = 1 ; } else { @@ -955,6 +975,7 @@ void hnj_hyphenation(halfword head, halfword tail) if (is_simple_character(rr)) { if (character(rr) == ex_hyphen_char_par) { t = compound_word_break(rr, clang); + check_automatic_disc(t); subtype(t) = automatic_disc; while (character(alink(rr)) == ex_hyphen_char_par) rr = alink(rr); diff --git a/source/texk/web2c/luatexdir/tex/commands.w b/source/texk/web2c/luatexdir/tex/commands.w index 8a81184dc975d8e5222eaab11c604542d52c165f..1e223839b71509f3a26672e71762d081e69b2bd8 100644 --- a/source/texk/web2c/luatexdir/tex/commands.w +++ b/source/texk/web2c/luatexdir/tex/commands.w @@ -157,6 +157,8 @@ void initialize_commands(void) primitive_luatex("pageheight", assign_dimen_cmd, dimen_base + page_height_code, dimen_base); primitive_luatex("pxdimen", assign_dimen_cmd, dimen_base + px_dimen_code, dimen_base); primitive_luatex("predisplaygapfactor", assign_int_cmd, int_base + math_pre_display_gap_factor_code, int_base); + primitive_luatex("automatichyphenmode", assign_int_cmd, int_base + automatic_hyphen_mode_code, int_base); + primitive_luatex("automatichyphenpenalty", assign_int_cmd, int_base + automatic_hyphen_penalty_code, int_base); /* Many of \TeX's primitives need no |equiv|, since they are identifiable by their |eq_type| alone. These primitives are loaded into the hash table diff --git a/source/texk/web2c/luatexdir/tex/dumpdata.w b/source/texk/web2c/luatexdir/tex/dumpdata.w index c7c2accaf157dc2b4d678bcfcfa4e04427e66593..0c4e51a759349a609d6aadc964b2c48e1379b0f8 100644 --- a/source/texk/web2c/luatexdir/tex/dumpdata.w +++ b/source/texk/web2c/luatexdir/tex/dumpdata.w @@ -23,7 +23,7 @@ /* we start with 907: the sum of the values of the bytes of "don knuth" */ -#define FORMAT_ID (907+26) +#define FORMAT_ID (907+27) #if ((FORMAT_ID>=0) && (FORMAT_ID<=256)) #error Wrong value for FORMAT_ID. #endif diff --git a/source/texk/web2c/luatexdir/tex/equivalents.h b/source/texk/web2c/luatexdir/tex/equivalents.h index 65102f0866f50978924f75db43b9cad77e4ea4ef..a97a6cf8b5a0b6e60aeea26134161721ca04ad81 100644 --- a/source/texk/web2c/luatexdir/tex/equivalents.h +++ b/source/texk/web2c/luatexdir/tex/equivalents.h @@ -288,8 +288,10 @@ the |number_regs| \.{\\dimen} registers. # define hyphenation_bounds_code 97 # define math_skip_mode_code 98 # define math_pre_display_gap_factor_code 99 +# define automatic_hyphen_mode_code 100 +# define automatic_hyphen_penalty_code 101 -# define math_option_code (math_skip_mode_code+1) +# define math_option_code (automatic_hyphen_penalty_code+1) # define mathoption_int_base_code (math_option_code+1) /* one reserve */ # define mathoption_int_last_code (mathoption_int_base_code+8) @@ -767,6 +769,9 @@ extern halfword last_cs_name; #define default_skew_char_par int_par(default_skew_char_code) #define saving_hyph_codes_par int_par(saving_hyph_codes_code) +#define automatic_hyphen_mode_par int_par(automatic_hyphen_mode_code) +#define automatic_hyphen_penalty_par int_par(automatic_hyphen_penalty_code) + #define cur_lang_par int_par(cur_lang_code) #define cur_font_par equiv(cur_font_loc)