Thanks very much. That isn't what I'm trying to do -- not any more. Originally I did want to do that, so as to line up metrical scansion marks -- rather like diacritics, you're right -- over text. But I didn't know about the formattedWidth property (which turns out to be nifty now that I know to look it up), & so couldn't see how to get the metric of the text itself. I resorted to doing all my scansions in Courier, where I could control the relation between lines. Of course it's uglier than a proportional font would be. If I were a Good Person I'd go back and use the method you suggest -- but it would involve, at a guess, several hundred example lines, and I don't have the heart.

My recent problem has been simply to line up blank, opaque fields covering the scansion marks, and reveal them at (the user's) will. I'm now solving that with Phil Davis's screenshot approach, which works fine for my purposes.

Thanks again -- learn something every day.

Charles


On Jul 27, 2005, at 11:25 AM, Devin Asay wrote:

Charles,

I'm jumping in late in the game, and basing my memory of what you're trying to do on my quick read through of your original message yesterday. If I understand it correctly, you are trying to accurately position some kind of diacritical markings above specific letters in a text field? Let me suggest an alternative that might avoid the cross-platform font metric issues. I did a project similar to this a couple of years ago, in which I needed to position Pinyin tone marks above vowels in romanized Chinese syllables. The tone marks were images. I used the formattedWidth property of the chunk of text up to and including the letter to be marked, then calculated the horizontal distance from the edge of the card to the letter in question and positioned the image there. For example:

|                 _________________
|<- left of card  |chunk in fld    |
|                 |<- left of fld  |
|                 |                |
|                 |                |
|                 _________________|

If I wanted to position the mark over the "u" in "chunk" I would use
the left of fld "myfld" + the formattedWidth of char 1 to 3 of fld "myfld" as the baseline x value, then by trial and error find the proper x and y adjustments to get my image to display at the desired spot.

This method should work regardless of font and size because the formattedWidth takes the current font settings of the chunk into account.

HTH

Devin

Devin Asay
Humanities Technology and Research Support Center
Brigham Young University

_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to