Skip to content

Commit

Permalink
mathml: fix a bunch of issues in glyph table
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmanuelP committed Sep 25, 2023
1 parent 56fd39c commit 62b6294
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions src/lsmmathmlglyphtableams.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ const LsmMathmlOperatorGlyph AMS_table[] = {
{
{LSM_MATHML_FONT_CMEX10, "e"},
{LSM_MATHML_FONT_CMEX10, "f"},
{LSM_MATHML_FONT_CMEX10, "g"}
{LSM_MATHML_FONT_CMEX10, "g"},
}
},
{
Expand Down Expand Up @@ -535,7 +535,7 @@ const LsmMathmlOperatorGlyph AMS_table[] = {
},
{
"-",
0,
LSM_MATHML_GLYPH_FLAG_STRETCH_HORIZONTAL,
{LSM_MATHML_FONT_ERROR, ""},
{LSM_MATHML_FONT_ERROR, ""},
{LSM_MATHML_FONT_ERROR, ""},
Expand All @@ -557,6 +557,18 @@ const LsmMathmlOperatorGlyph AMS_table[] = {
{LSM_MATHML_FONT_DEFAULT, "|"}
}
},
{
"\x5e" /* ^ ^ */,
LSM_MATHML_GLYPH_FLAG_STRETCH_HORIZONTAL,
{LSM_MATHML_FONT_ERROR, ""},
{LSM_MATHML_FONT_ERROR, ""},
{LSM_MATHML_FONT_ERROR, ""},
{LSM_MATHML_FONT_ERROR, ""},
1,
{
{LSM_MATHML_FONT_DEFAULT, "\x5e"}
}
},
};

static GHashTable *
Expand All @@ -566,7 +578,7 @@ _get_glyph_table (void)
LsmMathmlOperatorGlyph glyph_template =
{
"\xcc\x80",
LSM_MATHML_GLYPH_FLAG_STRETCH_VERTICAL,
0,
{LSM_MATHML_FONT_ERROR, ""},
{LSM_MATHML_FONT_ERROR, ""},
{LSM_MATHML_FONT_ERROR, ""},
Expand Down Expand Up @@ -604,11 +616,12 @@ _get_glyph_table (void)
glyph = g_new(LsmMathmlOperatorGlyph, 1);
memcpy (glyph, &glyph_template, sizeof (LsmMathmlOperatorGlyph));

g_hash_table_insert (glyph_table, (char *) glyph->utf8, glyph);
if (g_hash_table_lookup (glyph_table, (char *) glyph->utf8) == NULL)
g_hash_table_insert (glyph_table, (char *) glyph->utf8, glyph);
}

utf8[0] = '\xcd';
sized_utf8[0] = '\xcd';
sized_utf8[3] = '\xcd';
for (i = 0x80; i < 0xaf; i++) {
LsmMathmlOperatorGlyph *glyph;
char *utf8 = (char *) &glyph_template.utf8;
Expand All @@ -620,7 +633,8 @@ _get_glyph_table (void)
glyph = g_new(LsmMathmlOperatorGlyph, 1);
memcpy (glyph, &glyph_template, sizeof (LsmMathmlOperatorGlyph));

g_hash_table_insert (glyph_table, (char *) glyph->utf8, glyph);
if (g_hash_table_lookup (glyph_table, (char *) glyph->utf8) == NULL)
g_hash_table_insert (glyph_table, (char *) glyph->utf8, glyph);
}

return glyph_table;
Expand Down

0 comments on commit 62b6294

Please sign in to comment.