[REBOL] Re: Proportional Spaced Fonts
From: greggirwin:mindspring at: 23-Oct-2002 12:00
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
b2: parse "Book generation Jesus Christ son David son
lay-blk: [space 0x0]
repeat i length? b1 [
append lay-blk reduce ['text b1/:i 'text b2/:i 'return]
view layout lay-blk
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.