Bug 33510 - Preview some sample Arabic text in the font list when the font is designed for Arabic.
Summary: Preview some sample Arabic text in the font list when the font is designed fo...
Status: CLOSED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
Version:
(earliest affected)
3.3.0 RC4
Hardware: Other All
: medium normal
Assignee: Caolán McNamara
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-25 20:43 UTC by Fahad Al-Saidi
Modified: 2023-05-28 10:04 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments
So, how does this look to you ? (237.12 KB, image/png)
2011-01-31 07:55 UTC, Caolán McNamara
Details
stash this here for a bit (21.42 KB, patch)
2011-01-31 13:23 UTC, Caolán McNamara
Details
how about this ? (39.44 KB, image/png)
2011-02-06 01:44 UTC, Caolán McNamara
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Fahad Al-Saidi 2011-01-25 20:43:24 UTC
This is also an old bug with Arabic font in OpenOffice.org [1]. here is the description:
Arabic fonts do not display correctly like English font when we want to choose a font for format a text.

[1] http://qa.openoffice.org/issues/show_bug.cgi?id=49653
Comment 1 Noel Power 2011-01-27 07:56:54 UTC
caolan have you any ideas about this ( feel free to re-assign back to the list etc. etc. )
Comment 2 Caolán McNamara 2011-01-29 07:51:51 UTC
This will probably strike you as a stupid question, but what *is* the Arabic text written beside the font name in the MSOffice preview. i.e. 

a) Is it a localized name of the font, and I'm just failing to find where in e.g. the Andalus font that name is found, or...
b) Is it some random "sample text" that is always the same and written beside Arabic fonts when they don't have an Arabic name.
Comment 3 Fahad Al-Saidi 2011-01-29 11:46:34 UTC
I am not sure about this but it is just a random text like this: أبجد هوز
BTW libreOffice display Chinese fonts very well see this:

http://img401.imageshack.us/img401/3189/snapshot2w.png
Comment 4 Caolán McNamara 2011-01-29 12:37:35 UTC
Yeah, the Asian fonts typically have a few names fields in them, and include a name for itself in its own language. Looking at some sample Arabic fonts they typically only name themselves in English. So I assume the required magic is to detect Arabic (and probably some other script) fonts and stick some same text as the preview string. We sort of do this for our symbol fonts. 

So I reckon what we need it to distinguish a font that *has* an English name, *and* has glyphs to render its own name, but is designed for Arabic text and for the preview treat it a little like a symbol font and render some sample other text in it. Maybethe otlayout:arab key might be sufficient for this.
Comment 5 Caolán McNamara 2011-01-29 12:43:19 UTC
Uh huh, أبجد هوز حطي كلمن سعفص قرشت ثخذ ضظغ
These meaningless words collect all Arabic letters
I guess that's the origin of the preview text, the first two words of that are taken as the same text.
Comment 6 Caolán McNamara 2011-01-29 13:35:43 UTC
I guess we could query the GSUB header, and if it has one for "arab", and for nothing else I suppose, we can make it a candidate for preview rendering of some same Arabic text beside its name.
Comment 7 Fahad Al-Saidi 2011-01-29 20:43:32 UTC
(In reply to comment #6)
> I guess we could query the GSUB header, and if it has one for "arab", and for
> nothing else I suppose, we can make it a candidate for preview rendering of
> some same Arabic text beside its name.

This approach seems ok but I have a concern that many fonts support many languages like: Tahoma, DejaVu fonts, and ubuntu font.
Comment 8 Caolán McNamara 2011-01-30 05:57:31 UTC
Yeah, that's the open question. I'm thinking that we should only show Arabic preview text is the font *only* supports otlayout:arab, so e.g. "DejaVu Sans Mono" supports otlayout:arab, otlayout:cyrl, otlayout:grek, etc. and would have no Arabic preview, while "Paktype Naqsh" only supports otlayout:arab and *would* have an Arabic preview.

Any extend this for other script/languages as well, so e.g. "Lohit Tamil" with only otlayout:taml would have a Tamil preview.
Comment 9 Caolán McNamara 2011-01-31 07:55:04 UTC
Created attachment 42752 [details]
So, how does this look to you ?
Comment 10 Caolán McNamara 2011-01-31 13:23:52 UTC
Created attachment 42777 [details]
stash this here for a bit
Comment 11 Fahad Al-Saidi 2011-02-04 20:42:37 UTC
(In reply to comment #8)
> Yeah, that's the open question. I'm thinking that we should only show Arabic
> preview text is the font *only* supports otlayout:arab, so e.g. "DejaVu Sans
> Mono" supports otlayout:arab, otlayout:cyrl, otlayout:grek, etc. and would have
> no Arabic preview, while "Paktype Naqsh" only supports otlayout:arab and
> *would* have an Arabic preview.
> 
> Any extend this for other script/languages as well, so e.g. "Lohit Tamil" with
> only otlayout:taml would have a Tamil preview.

I tried to build LibreOffice but I failed. Anyway, it would be better if the libreoffice shows preview for Latin letters and the CTL local if is there. I mean, if I enabled Aarbic Oman local, the font preview will show me latin and arabic preview, despite the font support arabic or not.
Comment 12 ⁨خالد حسني⁩ 2011-02-05 15:13:38 UTC
>+                rSampleText = rtl::OUString("ﺺِﻓ ﺦَﻠﻗَ ﺥَﻭﺩِ ﻚَﻤِﺜﻟِ ﺎﻠﺸَﻤﺳِ ﺇِﺫ ﺏَﺰَﻐَﺗ ﻲَﺤﻇﻯ ﺎﻠﻀَﺠﻴﻋُ ﺐِﻫﺍ ﻦَﺟﻻﺀَ ﻢِﻌﻃﺍﺭِ  ", strlen("ﺺِﻓ ﺦَﻠﻗَ ﺥَﻭﺩِ ﻚَﻤِﺜﻟِ ﺎﻠﺸَﻤﺳِ ﺇِﺫ ﺏَﺰَﻐَﺗ ﻲَﺤﻇﻯ ﺎﻠﻀَﺠﻴﻋُ ﺐِﻫﺍ ﻦَﺟﻻﺀَ ﻢِﻌﻃﺍﺭِ  "), RTL_TEXTENCODING_UTF8);

This sample text string is bogus, looks like a broken attempt to pre-shape it or something. It should be:
صِف خَلقَ خَودِ كَمِثلِ الشَمسِ إِذ بَزَغَت يَحظى الضَجيعُ بِها نَجلاءَ مِعطارِ

Though "أبجد هوز..." is more widely used as an Arabic pangram (though it is not strictly a pangram but rather a mere aggregation of Arabic alphabet in the Abjadi order).
Comment 13 Caolán McNamara 2011-02-06 01:41:31 UTC
Yeah, it was just a quick and dirty cut and paste for demo purposes. Decided against pangrams eventually, too long :-)
Comment 14 Caolán McNamara 2011-02-06 01:44:08 UTC
Created attachment 42987 [details]
how about this ?

How does this look to you ?
Comment 15 Fahad Al-Saidi 2011-02-06 22:09:54 UTC
(In reply to comment #14)
> Created an attachment (id=42987) [details]
> how about this ?
> 
> How does this look to you ?

It looks nice even there is a long space between English preview and Arabic preview.
Comment 16 Caolán McNamara 2011-02-09 07:04:57 UTC
done now for 3.4