by Michael S. Kaplan, published on 2005/12/06 11:31 -08:00, original URI: http://blogs.msdn.com/michkap/archive/2005/12/06/500485.aspx
A while ago (way back in March of 2005), Ian Treleaven asked in the suggestion box:
There seem to be very few, possibly only one sample application showing how to use Uniscribe and its set of APIs. The 1060 page book, Developing International Software (MS Press) has only six high-level pages on the topic.
Do you have any experience with this API and any hints on how to use it? Any insight would be great.
Ian is correct, in general there are really only two samples I know of:
Beyond that, samples seem to be pretty scarce.
It used to trouble me a lot more than it does now, but this has more to do with the fact that almost nobody really needs to deal with the complexity of Uniscribe in their daily development work; they just need language support to simply work, the way it does when you use the regular Win32 API to build applications and it hooks into Uniscribe for you rather than forcing you to do the complex work to render the text.
Of course there are exceptions to this rule -- the people who work on the GIFT team to create new shaping engines for scripts to be supported obviously need that understanding, and the work done in Crystal Reports and in the Visual Studio environment is very impressive and without that work the script support in these applications would be much poorer for it.
Just this last month, Lloyd Dupont asked in the newsgroups:
I have written m own "RichTextView" using Uniscribe. Now I see there is a new text rendering class: SWF.TextRenderer.
I haven't tested it out yet but it seems interesting.
However I see a couple of issues with it:
- It doesn't gives me bidi "run" layout information so I have to call uniscribe to get that
- It only gives me string width, if I want to wrap my text around some boundary I have either to call MeasureText repitively or I have to use Uniscribe again
- It doesn't gives me cluster boundary for caret placement
- If I render unsuported char/glyph I don't know which kind of font fall back mechanism it uses so I'm not sure my measurement (which I should do with Uniscribe for reason 1,2,3) will fit the new drawing.
Is there any plan to improve these issues?
Clearly there is no specific reason to add full Uniscribe support in the TextRenderer class since its intent is not to provide such support, and if someone already has a Uniscribe wrapper then they should definitely use it.
I am sure some of the people who read this blog may also be exceptions to this rule, but I will push back to the extent of wanting more scenario-based questions rather than open-ended requests for samples. Since most people don't need to directly do complex script processing, it only makes sense to be sure that this is a road that needs to be travelled....
This post brought to you by "≈" (U+2248, a.k.a. ALMOST EQUAL TO)
# Mike on Tuesday, December 06, 2005 2:33 PM:
# Michael S. Kaplan on Tuesday, December 06, 2005 3:29 PM:
# Lonnie McCullough on Tuesday, December 06, 2005 5:20 PM:
# Mike on Tuesday, December 06, 2005 11:15 PM:
# Simon Cooke on Thursday, December 08, 2005 2:20 PM:
# Michael S. Kaplan on Thursday, December 08, 2005 3:16 PM:
# Simon Cooke on Friday, December 09, 2005 2:09 PM:
# Michael S. Kaplan on Monday, December 12, 2005 10:26 AM:
# Stephanie Legault on Monday, December 19, 2005 6:06 PM:
# John Daggett on Thursday, October 18, 2007 9:31 PM:
Buried in the bowels of Mozilla code is code that handles complex script rendering code using Uniscribe:
http://lxr.mozilla.org/seamonkey/source/gfx/thebes/src/gfxWindowsFonts.cpp#1566
There's also additional code that scans the list of fonts in the system and reads the cmap tables of each font:
http://lxr.mozilla.org/seamonkey/source/gfx/thebes/src/gfxWindowsPlatform.cpp
Should be fairly useful to someone looking at how Uniscribe is used in practice.
The "CVS Blame" link at the top of the page provides a way to see the checkin history per-line. Hovering over the checkin number will show the bug number related to the change. Looking through these bugs can also provide a lot of insight into specific problems encountered, especially obscure problems with complex scripts.
referenced by
2008/08/28 A technology is worth: $0; A sample showing how to use it: $0; A debug-able sample: Priceless!
2007/07/05 Those Uniscribe samples from 'the hardest working ISV in complex scripts'
2007/03/30 Determining if a font is gonna get it done
2006/03/11 Was someone still looking for Uniscribe samples?
2006/02/15 Mixing MLang and Uniscribe