gdi32: use usp10 to optionally generate glyphs for bidi strings

Shachar Shemesh shachar at
Sun Aug 8 00:44:02 CDT 2010

Alexandre Julliard wrote:
> Which of course demonstrates that gdi32 calls usp10 on native too. Maybe
> it does it indirectly through lpk.dll, but the end result is the same,
> you have a dependency on usp10.
I know I'm coming a bit late into the discussion, but just for the 
record, this is how Windows does it (as of Windows 2000):

    * GDI has a soft dependency on LPK.DLL. It tries to load it using
    * If it succeeds, and if there are no breakout flags, each call to
      ExtTextOut is redirected to the LPK version of that same call
    * LPK links with uniscribe for the actual BiDi processing, and also
      with GDI for the actual rendering of the result. Yes, this means a
      circular dependency.
    * The breakout flags are ETO_IGNORELANGUAGE and ETO_GLYPH_INDEX. If
      these are passed, GDI handles the request itself, without
      forwarding it to LPK. This prevents the infinite recursion that
      might, otherwise, happen.

I believe the reason for this twisted design is twofold. First, in 
Windows 2000, CTL (complex text layout) was an optional component, to be 
installed by a checkbox in the regional settings dialog. This meant that 
the entire LPK dll could just be dropped in, along with some fonts, and 
the system would start supporting BiDi. The second reason is because 
BiDi is a rather multi-layered process. With BiDi, support for multi 
line rendering (as done by DrawText in User32) requires some fairly 
complex processing before the text could be passed off to ExtTextOut for 
actual rendering. This way, all the BiDi code could be placed in one place.

Another reason, I believe, for this separation is that pre-Windows 2000 
(and more importantly, pre-uniscribe) Windows still had BiDi code, which 
was scattered all over the place, and which became obsolete (for one 
example - GetCharacterPlacement, which supposedly does BiDi, has no 
mechanism to choose the paragraph direction, without which no BiDi 
processing makes sense. The MSDN docs even explicitly state it is obsolete).

I believe the best route forward is to use an LPK *like* DLL. Not LPK 
itself, as that would require of us to reverse engineer a whole set of 
APIs that no one but us even call, but another DLL, injected into the 
dependency order at the same location, carrying a similar functionality. 
I would suggest "winelpk.dll" as the name, but that is, of course, 
entirely open.


Shachar Shemesh
Lingnu Open Source Consulting Ltd.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the wine-devel mailing list