Home » Developing U++ » U++ Developers corner » CJK woes
Re: Howto export japanese word to pdf? [message #7765 is a reply to message #7764] |
Sun, 21 January 2007 09:20 |
|
mirek
Messages: 13980 Registered: November 2005
|
Ultimate Member |
|
|
Quote: |
Then i changed DrawText.cpp, GetPage function.
ptr->GetMetrics(page, ptr->default_width);
//ptr->GetMetrics(140, ptr->default_width);
/*for(int i = 0; i < 256; i++)
if(ptr->default_width[i].width) {
for(int j = 0; j < 256; j++)
ptr->default_width[j] = ptr->default_width[i];
break;
}*/
I don`t know my changes will break everything, but the result is better.
|
Well, the purpose of that code is to save the space needed for character widths for CJK fonts (as all glyphs seem to be monospaced).
Unfortunately, the code was designed for chinesse glyphs (tries to read specific characters starting at unicode 140*256) and very likely these characters are missing in PMincho.
BTW, it is also interesting that widths are correct when the font is accessed as Arial - most likely in that case, some other font is used there to provide chinesse chars.
Anyway, I guess we should try to fix this for PMincho as well. What we need to have there is the correct monospaced width of CJK glyph. Any ideas?
Can you check whether width is gound (break is taken)?
Thinking about it, perhaps we should simply check the first 'page' used instead of 140:
FontInfo::CharMetrics *FontInfo::GetPage(int page) const
{
if(page >= 46 && !ptr->default_width) {
ptr->default_width = new CharMetrics[256];
ptr->GetMetrics(page, ptr->default_width);
for(int i = 0; i < 256; i++)
if(ptr->default_width[i].width) {
for(int j = 0; j < 256; j++)
ptr->default_width[j] = ptr->default_width[i];
break;
}
}
CharMetrics *& cm = ptr->width[page];
if(!cm) {
cm = new CharMetrics[256];
ptr->GetMetrics(page, cm);
if(page == 1)
ComposeMetrics(ptr->font, cm);
if(page >= 46) {
for(int i = 0; i < 256; i++) {
if(!(cm[i] == ptr->default_width[i]) && cm[i].width)
return cm;
}
delete[] cm;
cm = ptr->default_width;
}
}
return cm;
}
Can you check please?
Mirek
[Updated on: Sun, 21 January 2007 09:37] Report message to a moderator
|
|
|
|
|
CJK woes
|
|
|
Re: Howto export japanese word to pdf?
By: mirek on Fri, 12 January 2007 11:12
|
|
|
Re: Howto export japanese word to pdf?
|
|
|
Re: Howto export japanese word to pdf?
By: mirek on Fri, 12 January 2007 17:20
|
|
|
Re: Howto export japanese word to pdf?
|
|
|
Re: Howto export japanese word to pdf?
By: mirek on Sat, 13 January 2007 09:16
|
|
|
Re: Howto export japanese word to pdf?
|
|
|
Re: Howto export japanese word to pdf?
By: mirek on Sat, 13 January 2007 12:44
|
|
|
Re: Howto export japanese word to pdf?
|
|
|
Re: Howto export japanese word to pdf?
By: mirek on Sat, 13 January 2007 23:43
|
|
|
Re: Howto export japanese word to pdf?
|
|
|
Re: Howto export japanese word to pdf?
By: mirek on Mon, 15 January 2007 00:09
|
|
|
Re: Howto export japanese word to pdf?
|
|
|
Re: Howto export japanese word to pdf?
By: mirek on Thu, 18 January 2007 07:14
|
|
|
Re: Howto export japanese word to pdf?
|
|
|
Re: Howto export japanese word to pdf?
By: mirek on Thu, 18 January 2007 16:50
|
|
|
Re: Howto export japanese word to pdf?
|
|
|
Re: Howto export japanese word to pdf?
By: mirek on Sun, 21 January 2007 09:20
|
|
|
Re: Howto export japanese word to pdf?
|
|
|
Re: Howto export japanese word to pdf?
By: mirek on Sun, 21 January 2007 12:24
|
|
|
Re: Howto export japanese word to pdf?
|
|
|
Re: Howto export japanese word to pdf?
By: mirek on Mon, 22 January 2007 00:21
|
|
|
Re: Howto export japanese word to pdf?
|
Goto Forum:
Current Time: Wed May 15 17:25:47 CEST 2024
Total time taken to generate the page: 0.02593 seconds
|