Skip to main content

Android implementation font issue

1 reply [Last post]
madhurvyas
Offline
Joined: 2010-04-05
Points: 0

Hi,
when using system fonts in android, the style (bold, italic) is not applied to font, all system fonts are plain.
I created a fix for that, better this thing goes to implementation itself.
add this to the AndroidImplementation.java class.
<code>
public int getStyle(Object nativeFont) {
if (nativeFont instanceof Paint) {
Paint new_name = (Paint) nativeFont;
return new_name.getTypeface().getStyle();
}
return 0;
}
</code>

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Klemens Guest
Offline
Joined: 2010-11-12
Points: 0

Nice! I had the same issue but couldn't track it down - this seems to
work fine.
Thanks!

On 15.12.2010 12:14, forums@java.net wrote:
> Hi,
>
> when using system fonts in android, the style (bold, italic) is not applied
> to font, all system fonts are plain.
>
> I created a fix for that, better this thing goes to implementation itself.
>
> add this to the AndroidImplementation.java class.
>
>

> 
> public int getStyle(Object nativeFont) {
>         if (nativeFont instanceof Paint) {
>             Paint new_name = (Paint) nativeFont;
>             return new_name.getTypeface().getStyle();
>         }
>         return 0;
>     }
>
>

>
>
>
>