[cl-typesetting-devel] Re: [cl-pdf-devel] Character encoding?

Peter Seibel peter at gigamonkeys.com
Mon Feb 25 06:30:43 UTC 2008


Peter Seibel wrote:
> 
> Bah, this is probably really a cl-typesetting question.
> 
> 
> Peter Seibel wrote:
>> So let's say I'm using a Lisp that uses Unicode strings. I have some 
>> strings that contain characters such as u+2018 and u+2019 (i.e. curly 
>> quotes). If I'm using a non-Unicode font there are no font metrics for 
>> those code points and I get an array index error if I try to render 
>> those strings. But if I translate those to the corresponding cp-1252 
>> code points. On the other hand if I *am* using a Unicode font, I want 
>> to leave the strings alone. Would it make sense for cl-pdf, knowing 
>> what font is being used at the moment, to do this translation for me 
>> or not, as needed? If so, where's the best place for that to happen? 
>> In PUT-STRING?

So here's a patch that fixes my problem. I don't think it's really quite 
right--for one thing it just assumes that the Lisp is using Unicode 
strings which may not always be true. And it probably needs to be filled 
out with methods for other encodings. Plus I'm not at all sure that 
there isn't a much better place already in the code base to do this--I 
looked some at the encodings.lisp but couldn't quite figure out where 
those were used.

But my basic point is that cl-typesetting and/or cl-pdf should know what 
encoding the Lisp is using (i.e. how should one interpret the values 
returned by CHAR-CODE) and should know how to map those to the numeric 
values used as indices into fonts, at least for the case where CHAR-CODE 
returns Unicode code points and the fonts are something well understood 
like Unicode and CP1252. (Are the others? MacRoman?)

-Peter

-- 
Peter Seibel                     : peter at gigamonkeys.com
A Billion Monkeys Can't be Wrong : http://www.gigamonkeys.com/blog/
Practical Common Lisp            : http://www.gigamonkeys.com/book/
Coders at Work                   : http://www.codersatwork.com/



More information about the cl-typesetting-devel mailing list