OOo controls have a Struct FontDescriptor that contains all the information about the text (font name, point size, etc.) so one would hope that to make an editbox have the same font as the containing text range, all you would have to do is

textField.fontDescriptor = textRange.fontDescriptor

but no such luck. FontDescriptors apply to everything but actual text; text has all those properties as part of the CharacterProperties service, so each property has to be accessed separately:

fontDescriptor = textField.fontDescriptor
fontDescriptor.name = textRange.CharFontName
fontDescriptor.height = textRange.CharHeight
' etc.
textField.fontDescriptor = fontDescriptor

Note that you can't do textField.fontDescriptor.name = textRange.CharFontName, because Structs are always copied. Even if it makes no sense.textField.fontDescriptor.name creates a temporary copy of textField.fontDescriptor and modifies its name, leaving the original textField.fontDescriptor untouched

Leave a Reply


Warning: Undefined variable $user_ID in /home/public/blog/wp-content/themes/evanescence/comments.php on line 75