From d781bc36747ff545f9daeca5a9a4e69963d8207b Mon Sep 17 00:00:00 2001 From: "dcone%netscape.com" Date: Wed, 20 Feb 2002 05:55:52 +0000 Subject: [PATCH] bug=100324 r=dcone sr=attinasi. Checkin for ftang. Measure the cyrillic characters. git-svn-id: svn://10.0.0.236/trunk@115058 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/gfx/src/ps/nsAFMObject.cpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/mozilla/gfx/src/ps/nsAFMObject.cpp b/mozilla/gfx/src/ps/nsAFMObject.cpp index 08e83fd6da2..62d87bbc6eb 100644 --- a/mozilla/gfx/src/ps/nsAFMObject.cpp +++ b/mozilla/gfx/src/ps/nsAFMObject.cpp @@ -787,15 +787,24 @@ float totallen=0.0f; cptr = (PRUnichar*)aString; for(i=0;imAFMCharMetrics[idx].mW0x); - // if ( (*cptr == 0x0020) || (*cptr == 0x002c) ) - // printf("fwidth = %d\n", fwidth); + fwidth = 0; if (*cptr & 0xff00) - fwidth = 1056; - if ( (*cptr == 0x0020) || (*cptr == 0x002c) ) - fwidth = 1056; // space and comma are half size of a CJK width + { + if (0x0400 == (*cptr & 0xff00)) { // Cyrillic + fwidth = 600; + } else { + fwidth = 1056; + } + } else { + // < 0x0100 + asciichar = (*cptr)&0x00ff; + idx = asciichar-32; + if(idx >= 0 ) + fwidth = (PRInt32)(mPSFontInfo->mAFMCharMetrics[idx].mW0x); + else if (*cptr == 0x0020) + fwidth = 1056; + } + totallen += fwidth; }