summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Harris <bjh21@bjh21.me.uk>2007-02-04 14:16:26 +0000
committerBen Harris <bjh21@bjh21.me.uk>2007-02-04 14:16:26 +0000
commit89017ba7004b9cb9e944775232c5ab917b40f262 (patch)
tree22cca548b92cb7425157a8edfa55134f4f3df483
parent310feffa5a81b1daf35642f3ff8eda136910e83c (diff)
downloadhalibut-89017ba7004b9cb9e944775232c5ab917b40f262.zip
halibut-89017ba7004b9cb9e944775232c5ab917b40f262.tar.gz
halibut-89017ba7004b9cb9e944775232c5ab917b40f262.tar.bz2
halibut-89017ba7004b9cb9e944775232c5ab917b40f262.tar.xz
Tidy up the handling of non-standard glyphs by defining glyph_extern()
early and using it whenever we need the name of a non-standard glyph. [originally from svn r7216]
-rw-r--r--psdata.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/psdata.c b/psdata.c
index 7160587..8a01641 100644
--- a/psdata.c
+++ b/psdata.c
@@ -1125,15 +1125,22 @@ char const **extraglyphs = NULL;
glyph nextglyph = lenof(ps_glyphs_alphabetic);
tree234 *extrabyname = NULL;
+char const *glyph_extern(glyph glyph) {
+ if (glyph == NOGLYPH) return ".notdef";
+ if (glyph < lenof(ps_glyphs_alphabetic))
+ return ps_glyphs_alphabetic[glyph];
+ else
+ return extraglyphs[glyph - lenof(ps_glyphs_alphabetic)];
+}
+
static int glyphcmp(void *a, void *b) {
glyph ga = *(glyph *)a, gb = *(glyph *)b;
- return strcmp(extraglyphs[ga - lenof(ps_glyphs_alphabetic)],
- extraglyphs[gb - lenof(ps_glyphs_alphabetic)]);
+ return strcmp(glyph_extern(ga), glyph_extern(gb));
}
static int glyphcmp_search(void *a, void *b) {
glyph gb = *(glyph *)b;
- return strcmp(a, extraglyphs[gb - lenof(ps_glyphs_alphabetic)]);
+ return strcmp(a, glyph_extern(gb));
}
glyph glyph_intern(char const *glyphname) {
@@ -1170,14 +1177,6 @@ glyph glyph_intern(char const *glyphname) {
return k;
}
-char const *glyph_extern(glyph glyph) {
- if (glyph == NOGLYPH) return ".notdef";
- if (glyph < lenof(ps_glyphs_alphabetic))
- return ps_glyphs_alphabetic[glyph];
- else
- return extraglyphs[glyph - lenof(ps_glyphs_alphabetic)];
-}
-
/* ----------------------------------------------------------------------
* Mapping between PS character names (/aacute, /zcaron etc) and
* Unicode code points.