FLTK logo

FLTK1.3.0 load Unicode fonts very slow

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

FLTK1.3.0 load Unicode fonts very slow liaojifang Aug 23, 2011  
 
Hello:
  everyone!
  I am very pleased to see FLTK1.3.0 support for Unicode encoding.
But I found a problem when I initialized unicode fonts. I am by looking at the code and found that the problem lies in the function call XLoadQueryFont.it take a long time when  calling XLoadQueryFont(utf8Wrap.c) function.

Here is my code:when I use zysong18030,it is very slow.when I use iso8859,it is fast.
envirenment:
tinyx: X11R6 4.2
fltk: fltk1.3.0
compiler:powerpc-603e-linux-gcc
cpu: Media 5200


#include<FL/Fl.H>
#include<FL/Fl_Window.H>
#include<FL/Box.H>
static Fl_Font extra_font;

int main(int argc,char**argv)
{
  const char *utfstr="\xe4\xbd\x95\xe3\x82\x82\xe8\xa1\x8c\xe3\x82\x8b\xe3\x80\x82";

  Fl::set_font(extra_font,"-*-zysong18030-*-*-*-*-*-*-*-*-*-*-iso10646-1");
// Fl::set_font(extra_font,"-*-courier-*-*-*-*-*-*-*-*-*-*-iso8859-1");


  window = new Fl_Window(800,600);
  box = new Fl_Box(20,40,300,50,"Hello,World");
  box->box(FL_UP_BOX);
  box->labelfont(extra_font);
  box->labelsize(16);
  box->label(utfstr);

  box1 = new Fl_Box(20,100,300,50,"Hello,World");
  box1->box(FL_UP_BOX);
  box1->labelfont(extra_font);
  box1->labelsize(24);
  box1->label(utfstr);



  box2 = new Fl_Box(20,100,300,50,"Hello,World");
  box2->box(FL_UP_BOX);
  box2->labelfont(extra_font);
  box2->labelsize(32);
  box2->label(utfstr);

  window->end();
  window->show();
  return Fl::run();
}

 I have checked a few days.I have no idea  how to solve the problem, do you have any suggestions?
thanks.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.