Issue 73003 - special handling for CJK
Summary: special handling for CJK
Alias: None
Product: gsl
Classification: Code
Component: code (show other issues)
Version: OOo 2.1
Hardware: All All
: P3 Trivial (vote)
Target Milestone: OOo 3.x
Assignee: AOO issues mailing list
QA Contact:
Depends on:
Reported: 2006-12-30 08:44 UTC by pflin
Modified: 2017-05-20 11:31 UTC (History)
4 users (show)

See Also:
Latest Confirmation in: ---
Developer Difficulty: ---

patch to implement (8.90 KB, text/plain)
2006-12-30 08:45 UTC, pflin
no flags Details
latest patch (8.94 KB, text/plain)
2007-07-05 07:44 UTC, pflin
no flags Details
new patch to implement (6.84 KB, text/plain)
2007-07-23 10:30 UTC, pflin
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description pflin 2006-12-30 08:44:08 UTC
Attached is a patch of enhancement for CJK fonts in the following two behaviors.

1) When user selects a non CJK font for CJK text, the font family of the CJK
text   will be the selected non-CJK font. e.g, the original font family of the
CJK text is "FZSongTi", which supports CJK lang. However, when user selects a
western font "Arial Black" which doesn't supports CJK lang in font dropdown box
in toolbar for the CJK text, the font family of the CJK text will become "Arial
Black" even if "Arial Black" doesn't support CJK lang. 

I think this behavior is easy to confuse users. 

The better behavior is to check the selected font family whether it supports CJK
lang. If not, the font family should not be modified. (Similar to MS office and
Lotus SmartSuite)

2) In the charater properties dialog (Fomat --> Charater), the dropdown box of
Asian text font lists all the fonts including western, CJK and CTL fonts. 

I think the reasonable behavior just lists CJK fonts. 

I am not familiar with CTL, so just do CJK enhancement.

This patch is based on issue #54603
Comment 1 pflin 2006-12-30 08:45:07 UTC
Created attachment 41758 [details]
patch to implement
Comment 2 michael.ruess 2007-01-02 09:15:04 UTC
Reassigned to SBA.
Comment 3 pflin 2007-04-24 07:16:47 UTC
Waiting for review and verify
Comment 4 Mathias_Bauer 2007-05-14 09:22:46 UTC
Stephan, wouldn't it make sense to assign this issue to a developer?
Comment 5 Mathias_Bauer 2007-05-15 14:11:12 UTC
Frank, Herbert: what's your opinion about this patch?
Comment 6 frank.meies 2007-05-15 16:39:32 UTC
fme: So basically this patch prevents the user to accidentally choose a font
used for CJK that doesn't support CJK. The idea sounds reasonable to me. The
crucial point is whether PrintFontManager::IsCJKFont() does what we expect it to do.

fme->hdu: I guess this is more your field of expertise. Please have a look at
this patch.
Comment 7 frank.meies 2007-05-16 09:19:06 UTC
Comment 8 Mathias_Bauer 2007-06-08 16:07:42 UTC
selecting gsl component, fits better to task and developer
Comment 9 philipp.lohmann 2007-06-28 12:20:20 UTC
The patch as is will not be applied;  no #ifdef UNX and psprint in svx please.

However the feature per seems useful. setting to enthancment type.
Comment 10 2007-06-28 14:20:32 UTC
Comment 11 pflin 2007-07-02 07:31:33 UTC
pflin -> pl: The code base is changed. I will recreate the patch soon.
The patch is only available in Linux due to psprint restriction,
BTW,  do #ifdef UNX and psprint not allowed in svx?
Comment 12 philipp.lohmann 2007-07-02 10:06:26 UTC
pflin: an #ifdef UNX in svx is a sure sign that the system abstraction layers
are incomplete.  In this case for example  I'd expect a new API IsCJKFont() on
the Font class, which would then be implemented per system in vcl's SAL (system
abstraction layer). This would give us the opportunity to implement this on
other platforms, too. svx is a project building on layers that abstract the
system UI.

That said you will find a few examples of #ifdef this or that platform in svx,
but these are indicators of bad design.
Comment 13 pflin 2007-07-05 07:30:00 UTC
Create a new API IsSupportCJK in Font class per pl's comments.
Note that the patch is based on issue #54603, or it is not applied.
Comment 14 pflin 2007-07-05 07:44:29 UTC
Created attachment 46531 [details]
latest patch
Comment 15 philipp.lohmann 2007-07-05 08:56:03 UTC
looks much better to me.

pl->hdu: perhaps if you consider this patch you could ad a proper Sal interface
for this ? Is there any way to support this on the other platforms, too ?
Comment 16 2007-07-05 10:05:16 UTC
Yup, the patch looks good in all modules except the psprint part. The strong dependency of this patch on 
the other issue, which still requires a lot of work, is not so good. To determine the IsCJKAttribute() the info 
is already known from GetTTGlobalFontInfo() in psprint/source/fontsubset/sft.c => the info->urN 
(unicode-ranges) should suffice. See for the 
meaning of ur bits. The result should be cached by psprint's source/fontmanager/fontmanager.cxx
Comment 17 pflin 2007-07-10 03:38:44 UTC
pflin --> hdu, I have a question.
In order to call GetTTGlobalFontInfo(), I need to create a object TrueTypeFont.
Now I get the information FontInfo in FontNameBox::Fill
(svtools/source/control/ctrlbox.cxx) or SvxFontItem in
SvxScriptSetItem::PutItemForScriptT (svx/source/items/textitem.cxx). 
My question is how to create TrueTypeFont from the above information?
Comment 18 2007-07-10 06:54:05 UTC
@pflin: when psprint creates its font list and analyzes the font files everything you need is available then. 
The resulting bit bFontSupportsCJK should be cached then with the other font attributes. So you just need 
to change the psprint part of your patch to cache this result and get the result out of the cache in 
PrintFontManager::IsSupportCJK(). The alternative you suggested to open the font file every time one 
needs the CJK bit would be too expensive. Since the CJK-bit (and many other attributes like weight/slant/
width, etc.) for a font never changes over the lifetime of a font the other attributes are already cached. 
Adding the CJK bit as another attribute is not difficult.
Comment 19 pflin 2007-07-23 10:28:52 UTC
pflin --> hdu: New patch specail_handling_cjk_m217.diff to implement.
The patch is only available in Linux.

I met some barriers when I wanted to support it on Windows.
I got to know that the CJK-bit for font metric is loaded from
ImplWinFontData::ReadOs2Table in vcl/win/source/gdi/salgdi3.cxx.

Through OutputDevice::GetFontMetric, the CJK-bit for font metric can be got. But
how can I call this function from 
SvxScriptSetItem::PutItemForScriptT in svx/source/items/textitem.cxx?

Any suggestion is appreciated.
Comment 20 pflin 2007-07-23 10:30:11 UTC
Created attachment 46991 [details]
new patch to implement
Comment 21 Martin Hollmichel 2008-01-28 02:33:45 UTC
set target 3.0
Comment 22 2008-07-03 15:05:30 UTC
retarget a little
Comment 23 Marcus 2017-05-20 11:31:40 UTC
Reset assigne to the default "".