[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
putty can shape now..
- To: developer at arabeyes dot org
- Subject: putty can shape now..
- From: "ahmad khalifa" <ahmadkhalifa at hotmail dot com>
- Date: Mon, 09 Feb 2004 10:16:05 +0000
hello, mr. musab...
well, i think i have reached a solution for your first problem...
which is, u want to give ExtTextOut a string, and it draws it, without
shaping, or ReOrdering...
now here is what i found out...
when u call ExtTextOut with the flag ETO_GLYPH_INDEX, the input string
lpString, is not a
Unicode string oran ASCII string, its an INDEX string, that means (from what
i understand) that
lpString is a Double-Byte string of Glyph indices relative to the current
selected font in the given
display context...
How to Convert to the magik Index string..?? --> GetCharacterPlacement()...
GetCharacterPlacement takes a Single-Byte string, and returns a Double-Byte
String of Indices
now to give GetCharacterPlacement a single-byte string containing arabic
chars, you have
to convert from wide charecter (usually U+0637) to CP-1256 which is windows
code page
for arabic (see Arabeyes' resources page) for example... 0x0627 => 0xc7
someone from the senior Arabeyes members, should be able to help with this
easily...
and most important, in the PuTTY Configuration Dialog, goto Window/
Appearance---
choose a font and choose Arabic script (to turn the font's Code Page to
arabic)...
well, enough said... here is my code changes...
at the end of the do_text() function there is a comment that says
/* And 'normal' unicode characters */
look for the following ExtTextOut(), and add this before it...
//===================
GCP_RESULTS gcpr;
char buff1[1024];
char buff2[1024];
char buff4[1024];
ZeroMemory(buff1, 1020);
ZeroMemory(buff2, 1020);
ZeroMemory(buff4, 1020);
{
int ak;
for(ak=0; ak < 1020; ak++)
buff4[ak] = GCPCLASS_NEUTRAL;
}
ZeroMemory(&gcpr, sizeof(gcpr));
gcpr.lStructSize = sizeof(gcpr);
gcpr.lpGlyphs = buff1;
gcpr.lpOutString = buff2;
gcpr.lpClass = buff4;
gcpr.nGlyphs = 1020;
{
// this is a static array i wrote, to show you what charecters should be
used...
char temp1[] = { 0xd8, 0xda, 0xd9, 0xc7, 0xda, 0xd9, 0xda, 0xd9, 0x0};
GetCharacterPlacement(hdc, temp1, 8, 0, &gcpr, FLI_MASK | GCP_CLASSIN)
// GetCharacterPlacement() parses temp1 according to gcpr.lpClass
// and returns the Glyph Index in gcpr.lpGlyph...
}
ExtTextOut(hdc, x,
y - font_height * (lattr == LATTR_BOT) + text_adjust,
ETO_GLYPH_INDEX | ETO_CLIPPED | ETO_OPAQUE, &line_box, buff1, 8,
IpDx);
// the lpString used here is buff1, which is gcpr.lpGlyph...
//==============================
well... try it and tell me how it went...
_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail