[REBOL] Re: Proportional Spaced Fonts
From: louisaturk:coxinet at: 23-Oct-2002 22:37
Hi Gregg,
At 12:00 PM 10/23/2002 -0600, you wrote:
>Hi Louis,
>
><<
>Let's say we have two lines of text---one of Greek and one an English
>translation---, and that we want to line up the words of the translation
>directly under the Greek words.
>
>Bibloj genesewj Ihsou Cristou , uiou Dabid , uiou Abraam .
>Book generation Jesus Christ , son David , son Abraham .
> >>
>
>I know nothing about Greek, so this is just a general approach, which may
>not correctly account for the accents and breathing marks you mentioned.
>
>You can display the text in many ways. If you need seamless editing to go
>along with it, that's a bit tricker perhaps.
>
>First, you could use TEXT faces and let REBOL do all the work for you:
>
>b1: parse "Bibloj genesewj Ihsou Cristou uiou Dabid uiou
>Abraam" none
>b2: parse "Book generation Jesus Christ son David son
>Abraham" none
>
>lay-blk: [space 0x0]
>repeat i length? b1 [
> append lay-blk reduce ['text b1/:i 'text b2/:i 'return]
>]
>view layout lay-blk
I'm still studying this.
>If that isn't suitable, you could set each word into a face and use the
>SIZE-TEXT function to find out how wide the text is, then do something else,
>like find the wider of the pair of words and add them to the effect/draw
>block for a face, using the calculated offsets.
This definitely will work. I made a test program, and a letter with an
accent mark is shown as the same width as a letter without the accent
mark. I am playing with this. I'll probably have some more questions later.
Many thanks! this is a big breakthrough for me. I have been trying to
figure out how to do this for several years, and it is this simple with rebol!
Louis