aboutsummaryrefslogtreecommitdiffstats
path: root/z37.c
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2024-05-19 00:36:53 +0200
committerMatěj Cepl <mcepl@cepl.eu>2024-05-19 00:36:53 +0200
commit71d625f730d872791eef74d7999e1be28d5e5c7e (patch)
treee15070e9b9c169165b8d0410bc81851f68addb0f /z37.c
parentadfba3772459ce4261cfd17922271fee3443a7dc (diff)
downloadlout-71d625f730d872791eef74d7999e1be28d5e5c7e.tar.gz
Lout 3.40.
http://jeffreykingston.id.au/lout/lout-3.40.tar.gz
Diffstat (limited to 'z37.c')
-rw-r--r--z37.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/z37.c b/z37.c
index 914ba5c..85b3ccf 100644
--- a/z37.c
+++ b/z37.c
@@ -1091,7 +1091,7 @@ void FontChange(STYLE *style, OBJECT x)
OBJECT par[3], family, face, fsize, y = nilobj, link, new, old, tmpf;
GAP gp; FULL_LENGTH flen = 0; int num, c; unsigned inc;
struct metrics *newfnt, *oldfnt;
- FULL_CHAR *lig;
+ FULL_CHAR *lig, *old_lig;
int cmptop;
COMPOSITE *oldcmp, *newcmp;
FULL_LENGTH *oldks, *newks; int klen;
@@ -1467,7 +1467,16 @@ void FontChange(STYLE *style, OBJECT x)
if( finfo[font_count].size_table == (struct metrics *) NULL )
Error(37, 53, "run out of memory when changing font or font size",
FATAL, &fpos(x));
- finfo[font_count].lig_table = lig = finfo[font_num(old)].lig_table;
+
+ /* copy lig_table (sharing it is not safe) bug fix JeffK 25/06/13 */
+ lig = (FULL_CHAR *) malloc(2*MAX_CHARS*sizeof(FULL_CHAR));
+ old_lig = finfo[font_num(old)].lig_table;
+ if( lig == (FULL_CHAR *) NULL )
+ Error(37, 54, "run out of memory when changing font or font size",
+ FATAL, &fpos(x));
+ for( i = 0; i < 2*MAX_CHARS; i++ )
+ lig[i] = old_lig[i];
+ finfo[font_count].lig_table = lig;
/* scale old font to new size */
newfnt = finfo[font_num(new)].size_table;