Apache OpenOffice (AOO) Bugzilla – Issue 73003
special handling for CJK
Last modified: 2017-05-20 11:31:40 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
Created attachment 41758 [details] patch to implement
Reassigned to SBA.
Waiting for review and verify
Stephan, wouldn't it make sense to assign this issue to a developer?
Frank, Herbert: what's your opinion about this patch?
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.
.
selecting gsl component, fits better to task and developer
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.
accepted
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?
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.
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.
Created attachment 46531 [details] latest patch
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 ?
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 http://www.microsoft.com/typography/otspec/os2.htm for the meaning of ur bits. The result should be cached by psprint's source/fontmanager/fontmanager.cxx
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?
@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.
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.
Created attachment 46991 [details] new patch to implement
set target 3.0
retarget a little
Reset assigne to the default "issues@openoffice.apache.org".