Pango for iPhone

View: New views
2 Messages — Rating Filter:   Alert me  

Pango for iPhone

by Sajjad Naveed :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm trying to compile Pango for iPhone. I've already patched it to
work with  CoreText instead of ATSUI. But there's still one more thing
that needs to be taken care of i.e. Cocoa Framework. iPhone doesn't
have Cocoa framework as such but what it does have is Foundation
framework which offers many classes as Cocoa framework. After shifting
from Cocoa to Foundation framework there are essentially only two
places where Pango still needs to be patched:

1) In function 'pango_atsui_family_list_faces' in
'pangoatsui-fontmap.c', line # 173 & 174

NSFontManager *manager = [NSFontManager sharedFontManager];
NSArray *members = [manager availableMembersOfFontFamily:[NSString
stringWithUTF8String:real_family]];

Now, Foundation framework doesn't have NSFontManager

"http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSFontManager_Class/Reference/Reference.html"

Instead, there's UIFont

"http://developer.apple.com/IPhone/library/documentation/UIKit/Reference/UIFont_Class/index.html"

I'm kind of stuck here as you can see (links above) although we can
get fonts' names for a given family as required yet it's not evident
how will we get the weights or traits of fonts to come up with
equivalent method for 'availableMembersOfFontFamily'? Is that even
required or we can set some standard values? Can we somehow make pango
to get requied font with traits and weights from UIFont directly
instead first getting the list of available fonts and then choosing
from them (as UIFonts supports this)?

2) Masks... yes e.g. 'NSFixedPitchFontMask' as required by Pango are
also declared in Cocoa. We can however, declare them ourselves like

enum {
   NSItalicFontMask = 0x00000001,
   NSBoldFontMask = 0x00000002,
   NSUnboldFontMask = 0x00000004,
   NSNonStandardCharacterSetFontMask = 0x00000008,
   NSNarrowFontMask = 0x00000010,
   NSExpandedFontMask = 0x00000020,
   NSCondensedFontMask = 0x00000040,
   NSSmallCapsFontMask = 0x00000080,
   NSPosterFontMask = 0x00000100,
   NSCompressedFontMask = 0x00000200,
   NSFixedPitchFontMask = 0x00000400,
   NSUnitalicFontMask = 0x01000000
};

Will this work? It sure will compile...

Any thoughts, pointers, suggestions, help on these two issues will be
greatly appreciated..

Thanks,
Sajjad
_______________________________________________
gtk-i18n-list mailing list
gtk-i18n-list@...
http://mail.gnome.org/mailman/listinfo/gtk-i18n-list

Re: Pango for iPhone

by Behdad Esfahbod-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Sajjad,

If you figure this out, please file a but against Pango such that I can commit
this.

Thanks, and sorry that I can't help with the issues you raised,
behdad

On 07/04/2009 07:46 AM, Sajjad Naveed wrote:

> I'm trying to compile Pango for iPhone. I've already patched it to
> work with  CoreText instead of ATSUI. But there's still one more thing
> that needs to be taken care of i.e. Cocoa Framework. iPhone doesn't
> have Cocoa framework as such but what it does have is Foundation
> framework which offers many classes as Cocoa framework. After shifting
> from Cocoa to Foundation framework there are essentially only two
> places where Pango still needs to be patched:
>
> 1) In function 'pango_atsui_family_list_faces' in
> 'pangoatsui-fontmap.c', line # 173&  174
>
> NSFontManager *manager = [NSFontManager sharedFontManager];
> NSArray *members = [manager availableMembersOfFontFamily:[NSString
> stringWithUTF8String:real_family]];
>
> Now, Foundation framework doesn't have NSFontManager
>
> "http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSFontManager_Class/Reference/Reference.html"
>
> Instead, there's UIFont
>
> "http://developer.apple.com/IPhone/library/documentation/UIKit/Reference/UIFont_Class/index.html"
>
> I'm kind of stuck here as you can see (links above) although we can
> get fonts' names for a given family as required yet it's not evident
> how will we get the weights or traits of fonts to come up with
> equivalent method for 'availableMembersOfFontFamily'? Is that even
> required or we can set some standard values? Can we somehow make pango
> to get requied font with traits and weights from UIFont directly
> instead first getting the list of available fonts and then choosing
> from them (as UIFonts supports this)?
>
> 2) Masks... yes e.g. 'NSFixedPitchFontMask' as required by Pango are
> also declared in Cocoa. We can however, declare them ourselves like
>
> enum {
>     NSItalicFontMask = 0x00000001,
>     NSBoldFontMask = 0x00000002,
>     NSUnboldFontMask = 0x00000004,
>     NSNonStandardCharacterSetFontMask = 0x00000008,
>     NSNarrowFontMask = 0x00000010,
>     NSExpandedFontMask = 0x00000020,
>     NSCondensedFontMask = 0x00000040,
>     NSSmallCapsFontMask = 0x00000080,
>     NSPosterFontMask = 0x00000100,
>     NSCompressedFontMask = 0x00000200,
>     NSFixedPitchFontMask = 0x00000400,
>     NSUnitalicFontMask = 0x01000000
> };
>
> Will this work? It sure will compile...
>
> Any thoughts, pointers, suggestions, help on these two issues will be
> greatly appreciated..
>
> Thanks,
> Sajjad
> _______________________________________________
> gtk-i18n-list mailing list
> gtk-i18n-list@...
> http://mail.gnome.org/mailman/listinfo/gtk-i18n-list
>
_______________________________________________
gtk-i18n-list mailing list
gtk-i18n-list@...
http://mail.gnome.org/mailman/listinfo/gtk-i18n-list