diff options
author | Russ Cox <rsc@swtch.com> | 2012-12-03 15:55:13 -0500 |
---|---|---|
committer | Russ Cox <rsc@swtch.com> | 2012-12-03 15:55:13 -0500 |
commit | 09adcb09011d8cc1391b0f4553928fc9cfaf3970 (patch) | |
tree | f6474f49c9522632fa50844e967cb23487cbc3ce | |
parent | 1785490baa3720b70ebf10d2e6da99ffb81db728 (diff) | |
download | plan9port-09adcb09011d8cc1391b0f4553928fc9cfaf3970.tar.gz plan9port-09adcb09011d8cc1391b0f4553928fc9cfaf3970.tar.bz2 plan9port-09adcb09011d8cc1391b0f4553928fc9cfaf3970.zip |
fontsrv: make single quotes look like quotes
R=rsc
https://codereview.appspot.com/6864051
-rw-r--r-- | src/cmd/fontsrv/osx.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/cmd/fontsrv/osx.c b/src/cmd/fontsrv/osx.c index f393dd3c..a35eb4a5 100644 --- a/src/cmd/fontsrv/osx.c +++ b/src/cmd/fontsrv/osx.c @@ -18,6 +18,18 @@ extern void CGFontGetGlyphsForUnichars(CGFontRef, const UniChar[], const CGGlyph[], size_t); +int +mapUnicode(int i) +{ + switch(i) { + case '\'': + return 0x2019; + case '`': + return 0x2018; + } + return i; +} + char* mac2c(CFStringRef s) { @@ -89,7 +101,7 @@ subfontbbox(CGFontRef font, int lo, int hi) CGGlyph g; CGRect r; - u = i; + u = mapUnicode(i); CGFontGetGlyphsForUnichars(font, &u, &g, 1); if(g == 0 || !CGFontGetGlyphBBoxes(font, &g, 1, &r)) continue; @@ -144,7 +156,7 @@ load(XFont *f) // figure out where the letters are for(i=0; i<0xffff; i+=0x100) { for(j=0; j<0x100; j++) { - u[j] = i+j; + u[j] = mapUnicode(i+j); g[j] = 0; } CGFontGetGlyphsForUnichars(font, u, g, 256); @@ -233,7 +245,7 @@ mksubfont(char *name, int lo, int hi, int size, int antialias) fc->bottom = Dy(m->r); n = 0; - u[n++] = i; + u[n++] = mapUnicode(i); if(0) // debugging u[n++] = '|'; g[0] = 0; |