Skip to content
This repository has been archived by the owner on Mar 6, 2023. It is now read-only.

Commit

Permalink
patch for font overflow (HH) -- trunk
Browse files Browse the repository at this point in the history
git-svn-id: https://serveur-svn.lri.fr/svn/modhel/luatex/trunk@7138 0b2b3880-5936-4365-a048-eb17d2e5a6bf
  • Loading branch information
luigiScarso committed Apr 23, 2019
1 parent 342bdbe commit e4181e6
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 14 deletions.
36 changes: 31 additions & 5 deletions source/texk/web2c/luatexdir/lua/ltexlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1781,7 +1781,7 @@ static int getdelcodes(lua_State * L)
static int settex(lua_State * L)
{
const char *st;
int texstr;
int texstr, isprim;
size_t k;
int cur_cs1, cur_cmd1;
int isglobal = 0;
Expand Down Expand Up @@ -1814,7 +1814,9 @@ static int settex(lua_State * L)
return 0;
}
texstr = maketexlstring(st, k);
if (is_primitive(texstr)) {
isprim = is_primitive(texstr);
flush_str(texstr);
if (isprim) {
if (i == 3 && (lua_type(L,1) == LUA_TSTRING)) {
const char *s = lua_tostring(L, 1);
if (lua_key_eq(s,global))
Expand Down Expand Up @@ -2545,7 +2547,7 @@ static int tex_definefont(lua_State * L)
{
const char *csname;
int f, u;
str_number t;
str_number t, d;
size_t l;
int i = 1;
int a = 0;
Expand All @@ -2559,7 +2561,6 @@ static int tex_definefont(lua_State * L)
}
csname = luaL_checklstring(L, i, &l);
f = luaL_checkinteger(L, (i + 1));
t = maketexlstring(csname, l);
no_new_control_sequence = 0;
u = string_lookup(csname, l);
no_new_control_sequence = 1;
Expand All @@ -2568,7 +2569,32 @@ static int tex_definefont(lua_State * L)
else
eq_define(u, set_font_cmd, f);
eqtb[font_id_base + f] = eqtb[u];
hash_text(font_id_base + f) = t;
/*tex
This is tricky: when we redefine a string we loose the old one. So this
will change as it's only used to display the |\fontname| so we can store
that with the font.
*/
d = cs_text(font_id_base + f);
t = maketexlstring(csname, l); /* the csname */
if (!d) {
/*tex We have a new string. */
cs_text(font_id_base + f) = t;
} else if (str_eq_str(d,t)){
/*tex We have the same string. */
flush_str(t);
} else {
d = search_string(t);
if (d) {
/*tex We have already such a string. */
cs_text(font_id_base + f) = d;
flush_str(t);
} else {
/*tex The old value is lost but still in the pool. */
cs_text(font_id_base + f) = t;
}
}
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion source/texk/web2c/luatexdir/luatex_svnversion.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define luatex_svn_revision 7132
#define luatex_svn_revision 7135
44 changes: 36 additions & 8 deletions source/texk/web2c/luatexdir/tex/texdeffont.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void tex_def_font(small_number a)
/*tex This runs through existing fonts. */
internal_font_number f;
/*tex The name for the frozen font identifier. */
str_number t;
str_number t, d;
/*tex Thos holds the |selector| setting. */
int old_setting;
/*tex Stated `at' size, or negative of scaled magnification. */
Expand All @@ -113,10 +113,6 @@ void tex_def_font(small_number a)
}
get_r_token();
u = cur_cs;
if (u >= null_cs)
t = cs_text(u);
else
t = maketexstring("FONT");
if (a >= 4) {
geq_define(u, set_font_cmd, null_font);
} else {
Expand All @@ -140,17 +136,20 @@ void tex_def_font(small_number a)
selector = new_string;
if (cur_area != get_nullstr()) {
print(cur_area);
flush_str(cur_area);
}
if (cur_name != get_nullstr()) {
print(cur_name);
flush_str(cur_name);
}
if (cur_ext != get_nullstr()) {
print(cur_ext);
flush_str(cur_ext);
}
selector = old_setting;
cur_area = get_nullstr();
cur_name = make_string();
cur_ext = get_nullstr();
cur_area = get_nullstr();
}
} else {
back_input();
Expand All @@ -160,9 +159,9 @@ void tex_def_font(small_number a)
token_show(def_ref);
selector = old_setting;
flush_list(def_ref);
cur_area = get_nullstr();
cur_name = make_string();
cur_ext = get_nullstr();
cur_area = get_nullstr();
}
/*tex
Scan the font size specification. The next variable keeps |cur_name| from
Expand Down Expand Up @@ -215,5 +214,34 @@ void tex_def_font(small_number a)
xfree(fn);
equiv(u) = f;
eqtb[font_id_base + f] = eqtb[u];
cs_text(font_id_base + f) = t;
/*tex
This is tricky: when we redefine a string we loose the old one. So this
will change as it's only used to display the |\fontname| so we can store
that with the font.
*/
d = cs_text(font_id_base + f);
t = (u >= null_cs) ? cs_text(u) : maketexstring("FONT");
if (!d) {
/*tex We have a new string. */
cs_text(font_id_base + f) = t;
} else if (str_eq_str(d,t)){
/*tex We have the same string. */
flush_str(t);
} else {
d = search_string(t);
if (d) {
/*tex We have already such a string. */
cs_text(font_id_base + f) = d;
flush_str(t);
} else {
/*tex The old value is lost but still in the pool. */
cs_text(font_id_base + f) = t;
}
}
if (cur_name == str_ptr-1) {
flush_str(cur_name);
cur_name = get_nullstr();
}
}

0 comments on commit e4181e6

Please sign in to comment.