pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From calathus <calat...@gmail.com>
Subject Re: [pivot]how to display Japanese Fonts using only Java class?
Date Tue, 11 Jan 2011 10:01:31 GMT
apptaro,
Thanks for hints,

I could fix the problem.

in the following codes:
     Font font = new Font("Sazanami Gothic Regular", Font.PLAIN, 1);
     Theme.getTheme().setFont(font);
     ...

       setText("こんにちは BXML!");
       setStyles("{font:'Arial bold 24', color:'#ff0000',
horizontalAlignment:'center', verticalAlignment:'center'}");

I set Arial for the font in the setStyles, but there is no Arial in Sazanami
fonts.
If we replace Arial by Gothic, it works:
 setStyles("{font:'Gothic bold 24', color:'#ff0000',
horizontalAlignment:'center', verticalAlignment:'center'}"); // this works

On Mon, Jan 10, 2011 at 6:27 PM, Taro App <apptaro@gmail.com> wrote:

> Hi calathus,
>
> For me, the code below works. This may be a hint for you.
>
> // set font to workaround japanese display issue
> Theme theme = Theme.getTheme();
> theme.setFont(new Font("MS Mincho", Font.PLAIN, 12));
>
> apptaro
>
>
> On Tue, Jan 11, 2011 at 10:58 AM, calathus <calathus@gmail.com> wrote:
> > Thanks for reply.
> > I set fonts at beginning of the startup method, but still it does not
> show
> > Japanese fonts.
> > What is wrong here? Should we use fontFamily as font name???
> >     @Override
> >     public void startup(Display display, Map<String, String> properties)
> > throws Exception {
> >      GraphicsEnvironment ge =
> > GraphicsEnvironment.getLocalGraphicsEnvironment();
> >      String []fontFamilies = ge.getAvailableFontFamilyNames();
> >      for (String fontFamily: fontFamilies) {
> >      System.out.println("fontFamily: "+fontFamily);
> >      } // ==> this shows "Sazanami Gothic", "Sazanami Mincho"
> >      //Font font = new Font("Sazanami Gothic", Font.TRUETYPE_FONT, 12);
> >      for (final String fontFamily: new String[]{"Sazanami Gothic",
> "Sazanami
> > Mincho"}) {
> >                 // do we need to put all these size???
> >      for(int i=12; i<=30; i++) {
> >      final Font font = new Font(fontFamily, Font.PLAIN, i);
> >      //final Font font = new Font(fontFamily, Font.TRUETYPE_FONT, i);
> >      Theme.getTheme().setFont(font);
> >      }
> >      }
> > ....
> > }
> >
> >
> > On Mon, Jan 10, 2011 at 4:39 AM, Greg Brown <gk_brown@verizon.net>
> wrote:
> >>
> >> > Is it possible to use Japanese fonts in Pivot ??
> >>
> >> Yes, but the default font (Verdana) does not include Japanese
> characters.
> >> When your app starts up, you just need to set a font that does include
> >> Japanese characters. You set the theme font via
> Theme.getTheme().setFont().
> >>
> >> G
> >>
> >>
> >
> >
> >
> > --
> > Cheers,
> > calathus
> >
> >
> >
> >
>



-- 
Cheers,
calathus

Mime
View raw message