Another possibility to generate postscript or pdf through CAIRO as a backend.
I have quite a lot of of working code (all fltk drawing primitives except/but images only partially) using CAIRO implementation. The implementation used #idfef(s) and I was waiting for the FLTK device api to be stabilised to make full port. It uses "toy api" for fonts but this api seems sufficient for fltk needs and it accepts utf-8 strings out of the box - so also international text by postscript-through-cairo should work. Now when Fl_Device is in 1.3 it might be the right time to start to play with it again. Unfortunately I am very busy this days/weeks/months but it should be now much easier to implement Fl_Cairo_Device independent of fltk and maybe later to include it in fltk core as some fltk_cairo library when it is stable and tested. Once this cairo implementation is in place, output to postscriot/pdf/whatever should be relatively easy by swapping cairo backends. I am not sure how Fl_Device and Fl_Printer classes inheritance is implemented so it might require some tweaking to reuse the code for both screen and stream outputs. With regards to printing of Fl_Help_View content: Fl_Help_View must export some additional api - at leas make format() or something similar public to allow to reformat (eg with regard to the page width) and also allow to draw() of sequence of blocks (lines) to allow paging etc. It also should export some measurement functions (like the height of block sequence) to calculate position on the page, number of pages... The code was tested only on windows/VC - all test programs worked nicely with exception of images which were not drawn. There are no X or mac drawables implemented but as there is now cairo drawable within fltk itself this should further simplify the implementation. Note that this fork also includes the cairo source within fltk (similar to zlib/jpeg/png libraries) and custom VC project to build it to keep it independent of external libraries. The cairo version is very ancient though and should be replaced or completely removed from the tree. I will try to dig-out this code during the weekend if somebody wants to play with it. If I remember it was based on fltk-1.1.9 so making diff against 1.1.9 tree or searching for #ifdef USE_CAIRO should get you to the cairo-specific code. If somebody is interested, please let me know and I will put this fork on my server. R. Albrecht Schlosser wrote: >> But the point is, even if the widget itself will display non-ASCII >> characters using UTF-8 encoding, the Fl_Postscript_Printer won't print them >> :( If I'm not mistaken, I saw it in the 1.3.x docs: by now only Latin chars >> are supported... >> >> I just wonder, is there a way (no matter how strange and perverted :)) to >> print cyrillic text in fltk-1.3.x? > > I'm afraid you're right. Currently Fl_PostScript_Printer only knows the > standard FLTK fonts that are mapped to the standard PS fonts - and AFAIK > these are Latin fonts, and Fl_Postscript_Printer replaces all non-latin > characters with a reverted question mark. > > So, what we would need is a way to specify a user font (e.g. a cyrillic one) > and a way to specify the font mapping (UTF-8 to font character codes). > Neither is implemented currently, and there's no API defined for this. :-( > > Any ideas and/or code would be appreciated. > _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

