Index: src/Graphics/Bitmap_fonts/bitmap_font.cpp =================================================================== --- src/Graphics/Bitmap_fonts/bitmap_font.cpp (revision 2729) +++ src/Graphics/Bitmap_fonts/bitmap_font.cpp (working copy) @@ -65,7 +65,11 @@ ******************************************************************************/ font_glyphs_rep::font_glyphs_rep (string name): - rep (name), bad_font_glyphs (false) {} + rep (name), bad_font_glyphs (false) + #ifdef QTTEXMACS + ,is_qt_font(false) + #endif + {} font_glyphs_rep::~font_glyphs_rep () { FAILED ("not yet implemented"); } Index: src/Graphics/Bitmap_fonts/bitmap_font.hpp =================================================================== --- src/Graphics/Bitmap_fonts/bitmap_font.hpp (revision 2729) +++ src/Graphics/Bitmap_fonts/bitmap_font.hpp (working copy) @@ -13,6 +13,10 @@ #define BITMAP_FONT_H #include "resource.hpp" +#ifdef QTTEXMACS +#include +#endif + RESOURCE(font_metric); RESOURCE(font_glyphs); @@ -101,6 +105,10 @@ font_glyphs_rep (string name); virtual ~font_glyphs_rep (); virtual glyph& get (int char_code) = 0; + +#ifdef QTTEXMACS + bool is_qt_font; +#endif }; font_metric std_font_metric (string s, metric* fnm, int bc, int ec); Index: src/Graphics/Renderer/printer.cpp =================================================================== --- src/Graphics/Renderer/printer.cpp (revision 2729) +++ src/Graphics/Renderer/printer.cpp (working copy) @@ -458,17 +458,30 @@ string name = tex_fonts [fn_name], ttf; int pos = search_forwards (".", fn_name); string root = (pos==-1? fn_name: fn_name (0, pos)); -#ifndef OS_WIN32 // we need pfbtopfa + if ((pos!=-1) && ends (fn_name, "tt")) { int pos2= search_backwards (":", fn_name); root= fn_name (0, pos2); - url u= tt_font_find (root); - if (suffix (u) == "pfb") { - ttf = pfb_to_pfa (u); + + url u= tt_locate(root * ".pfa"); + if( !is_none(u) ) { + load_string(u, ttf, false); } + else if( !is_none( u = tt_locate(root * ".t42") ) ) { + load_string(u, ttf, false); + } + else { + cout<<"falling back with font "<contains (root)) { Index: src/Plugins/Freetype/tt_face.cpp =================================================================== --- src/Plugins/Freetype/tt_face.cpp (revision 2729) +++ src/Plugins/Freetype/tt_face.cpp (working copy) @@ -16,6 +16,10 @@ #ifdef USE_FREETYPE +#ifdef QTTEXMACS +#include +#endif + RESOURCE_CODE(tt_face); inline int tt_round (int l) { return ((l+0x400020) >> 6) - 0x10000; } @@ -70,6 +74,7 @@ metric& tt_font_metric_rep::get (int i) { +cout << "get font (metic) glyph "<< (char)i << " for font "<contains(i)) { ft_set_char_size (face->ft_face, 0, size<<6, dpi, dpi); FT_UInt glyph_index= ft_get_char_index (face->ft_face, i); @@ -115,6 +120,36 @@ string name, string family, int size2, int dpi2): font_glyphs_rep (name), size (size2), dpi (dpi2), fng (glyph ()) { +#ifdef QTTEXMACS +cout << "tt_font_glyphs constructor: "; +cout << "name: "<< name <<"; family: "<bad_face || ft_set_char_size (face->ft_face, 0, size<<6, dpi, dpi); @@ -123,6 +158,7 @@ glyph& tt_font_glyphs_rep::get (int i) { +cout << "get font glyph "<< (char)i << " for font "<contains(i)) { ft_set_char_size (face->ft_face, 0, size<<6, dpi, dpi); FT_UInt glyph_index= ft_get_char_index (face->ft_face, i); Index: src/Plugins/Freetype/tt_file.cpp =================================================================== --- src/Plugins/Freetype/tt_file.cpp (revision 2729) +++ src/Plugins/Freetype/tt_file.cpp (working copy) @@ -26,9 +26,10 @@ return expand (dirs); } -static url +url tt_locate (string name) { - if (ends (name, ".pfb")) { + if (ends (name, ".pfb") || ends(name, ".otf") || ends(name, ".ttf") || + ends(name, ".pfa") || ends(name, ".t42")) { /* if (starts (name, "rpag")) name= "uag" * name (4, N (name) - 4) * "8a.pfb"; if (starts (name, "rpbk")) name= "ubk" * name (4, N (name) - 4) * "8a.pfb"; @@ -42,6 +43,7 @@ if (starts (name, "rpzd")) name= "uzd" * name (4, N (name)); */ url u= resolve_tex (name); + cout << "looking for "< " << u << "\n"; if (!is_none (u)) return u; } @@ -76,10 +78,12 @@ url tt_font_find (string name) { - url u= tt_locate (name * ".pfb"); - //if (!is_none (u)) cout << name << " -> " << u << "\n"; + url u = tt_locate(name * ".otf"); if (!is_none (u)) return u; u= tt_locate (name * ".ttf"); + if (!is_none (u)) return u; + + u= tt_locate (name * ".pfb"); //if (!is_none (u)) cout << name << " -> " << u << "\n"; //else cout << name << " -> ???\n"; return u; Index: src/Plugins/Freetype/tt_face.hpp =================================================================== --- src/Plugins/Freetype/tt_face.hpp (revision 2729) +++ src/Plugins/Freetype/tt_face.hpp (working copy) @@ -15,6 +15,10 @@ #include "Freetype/free_type.hpp" #include "hashmap.hpp" +#ifdef QTTEXMACS +#include +#endif + #ifdef USE_FREETYPE RESOURCE(tt_face); @@ -43,6 +47,9 @@ hashmap fng; //glyph* fng; //bool* done; +#ifdef QTTEXMACS + QFont qt_font; +#endif tt_font_glyphs_rep (string name, string family, int size, int dpi); glyph& get (int char_code); }; Index: src/Plugins/Freetype/tt_file.hpp =================================================================== --- src/Plugins/Freetype/tt_file.hpp (revision 2729) +++ src/Plugins/Freetype/tt_file.hpp (working copy) @@ -16,5 +16,6 @@ bool tt_font_exists (string name); url tt_font_find (string name); string tt_find_name (string name, int size); +url tt_locate(string name); #endif // TT_FILE_H Index: src/Plugins/Qt/qt_renderer.cpp =================================================================== --- src/Plugins/Qt/qt_renderer.cpp (revision 2729) +++ src/Plugins/Qt/qt_renderer.cpp (working copy) @@ -15,6 +15,7 @@ #include "qt_utilities.hpp" #include "file.hpp" #include +#include "Freetype/tt_face.hpp" #ifdef MACOSX_EXTENSIONS #include "MacOS/mac_images.h" @@ -333,6 +334,23 @@ void qt_renderer_rep::draw (int c, font_glyphs fng, SI x, SI y) { + if( fng->is_qt_font ) { + tt_font_glyphs_rep *ttfng = static_cast(fng.rep); + int size = ttfng->size; + int dpi = ttfng->dpi; + int pixel_size = (size * dpi) / ( 72 * sfactor); + + QFont *font = &ttfng->qt_font; + font->setPixelSize(pixel_size); + painter.setFont(*font); + + decode(x, y); + char str[2] = {c, '\0'}; + + painter.drawText(x, y, str); + return; + } + // get the pixmap basic_character xc (c, fng, sfactor, cur_fg, 0); qt_image mi = character_image [xc]; @@ -348,7 +366,7 @@ { int nr_cols= sfactor*sfactor; if (nr_cols >= 64) nr_cols= 64; - + QPainter pp(im); QPen pen(painter.pen()); QBrush brush(pen.color()); Index: src/Plugins/Metafont/load_tex.cpp =================================================================== --- src/Plugins/Metafont/load_tex.cpp (revision 2729) +++ src/Plugins/Metafont/load_tex.cpp (working copy) @@ -35,7 +35,7 @@ bool try_tfm (string family, int size, int osize, tex_font_metric& tfm, bool make) { - // cout << "Try tfm " << family << size << " (" << osize << ")\n"; + cout << "Try tfm " << family << size << " (" << osize << ")\n"; make= make && get_setting ("MAKETFM") != "false"; string name_tfm = family * as_string (osize) * ".tfm"; if (tex_font_metric::instances -> contains (name_tfm)) { Index: src/Plugins/Metafont/tex_files.cpp =================================================================== --- src/Plugins/Metafont/tex_files.cpp (revision 2729) +++ src/Plugins/Metafont/tex_files.cpp (working copy) @@ -93,7 +93,9 @@ } if (ends (s, "tfm")) u= resolve_tfm (name); if (ends (s, "pk" )) u= resolve_pk (name); - if (ends (s, "pfb")) u= resolve_pfb (name); + else if (ends (s, "otf") || ends (s, "ttf") || ends (s, "pfb") || + ends (s, "pfa") || ends (s, "t42")) + u= resolve_pfb (name); bench_cumul ("resolve tex"); if (!is_none (u)) cache_set ("font_cache.scm", s, as_string (u)); Index: src/Plugins/Metafont/tex_font.cpp =================================================================== --- src/Plugins/Metafont/tex_font.cpp (revision 2729) +++ src/Plugins/Metafont/tex_font.cpp (working copy) @@ -502,42 +502,42 @@ SI x1= 0; SI x2= 0; - SI x3= PLUS_INFINITY; - SI x4= MINUS_INFINITY; + //SI x3= PLUS_INFINITY; + //SI x4= MINUS_INFINITY; SI y1= PLUS_INFINITY; SI y2= MINUS_INFINITY; - SI y3= PLUS_INFINITY; - SI y4= MINUS_INFINITY; + //SI y3= PLUS_INFINITY; + //SI y4= MINUS_INFINITY; for (i=0; iget (c); - if (is_nil (gl)) continue; + //glyph gl= pk->get (c); + //if (is_nil (gl)) continue; y1= min (y1, -conv (tfm->d(c))); y2= max (y2, conv (tfm->h(c))); - x3= min (x3, x2- ((int) gl->xoff) * PIXEL); - x4= max (x4, x2+ ((int) (gl->width- gl->xoff)) * PIXEL); - y3= min (y3, ((int) (gl->yoff- gl->height)) * PIXEL); - y4= max (y4, ((int) gl->yoff) * PIXEL); + //x3= min (x3, x2- ((int) gl->xoff) * PIXEL); + //x4= max (x4, x2+ ((int) (gl->width- gl->xoff)) * PIXEL); + //y3= min (y3, ((int) (gl->yoff- gl->height)) * PIXEL); + //y4= max (y4, ((int) gl->yoff) * PIXEL); x2 += conv (tfm->w(c)+ ker[i]); } - +/* if ((x3 == PLUS_INFINITY) || (x4 == MINUS_INFINITY) || (y3 == PLUS_INFINITY) || (y4 == MINUS_INFINITY)) { x1= x3= x2= x4= 0; y3= y1= 0; y4= y2= yx; } - +*/ ex->x1= x1; ex->x2= x2; - ex->x3= x3 - 2*PIXEL; - ex->x4= x4 + 2*PIXEL; + ex->x3= 0;//x3 - 2*PIXEL; + ex->x4= 0;//x4 + 2*PIXEL; ex->y1= y1; ex->y2= y2; - ex->y3= y3 - 2*PIXEL; - ex->y4= y4 + 2*PIXEL; + ex->y3= 0;//y3 - 2*PIXEL; + ex->y4= 0;//y4 + 2*PIXEL; STACK_DELETE_ARRAY (s_copy); STACK_DELETE_ARRAY (buf); @@ -623,8 +623,14 @@ for (i=0; iget (c); - if (is_nil (gl)) continue; + #ifdef QTTEXMACS + if(!pk->is_qt_font) { + #endif + glyph gl= pk->get (c); + if (is_nil (gl)) continue; + #ifdef QTTEXMACS + } + #endif ren->draw (c, pk, x, y); x += conv (tfm->w(c)+ ker[i]); } Index: misc/admin/admin.makefile =================================================================== --- misc/admin/admin.makefile (revision 2729) +++ misc/admin/admin.makefile (working copy) @@ -19,11 +19,11 @@ tmdir = TeXmacs tmtgz = TeXmacs-1.0.7.2 tmrpm = TeXmacs-1.0.7.2-1 -tmorig = /Users/vdhoeven/texmacs/src -tmsrc = /Users/vdhoeven/texmacs/src/TeXmacs +tmorig = /home/alex/etc/texmacs/svn5/src +tmsrc = /home/alex/etc/texmacs/svn5/src/TeXmacs tmbin = ${exec_prefix}/libexec/TeXmacs tmdata = ${datarootdir}/TeXmacs -so = dylib +so = so os = gnu-linux MKDIR = mkdir -p