-static int paps_conic_to( FT_Vector* control,
- FT_Vector* to,
- void *user_data)
-{
- OutlineInfo *outline_info = (OutlineInfo*)user_data;
- fprintf(outline_info->file, "%d %d %d %d conicto\n",
- (int)control->x ,
- (int)control->y ,
- (int)to->x ,
- (int)to->y );
- return 0;
-}
-
-static int paps_cubic_to( FT_Vector* control1,
- FT_Vector* control2,
- FT_Vector* to,
- void *user_data)
-{
- OutlineInfo *outline_info = (OutlineInfo*)user_data;
- fprintf(outline_info->file,
- "%d %d %d %d %d %d curveto\n",
- (int)control1->x ,
- (int)control1->y ,
- (int)control2->x ,
- (int)control2->y ,
- (int)to->x ,
- (int)to->y );
- return 0;
-}
-
-void draw_bezier_outline(FILE *file,
- FT_Face face,
- FT_UInt glyph_index,
- int pos_x,
- int pos_y,
- int scale_x,
- int scale_y )
-{
- FT_Int load_flags = FT_LOAD_NO_BITMAP;
- FT_Glyph glyph;
-
- FT_Outline_Funcs outlinefunc =
- {
- paps_move_to,
- paps_line_to,
- paps_conic_to,
- paps_cubic_to
- };
-
- OutlineInfo outline_info;
- outline_info.file = file;
-
- fprintf(file, "gsave\n");
- fprintf(file, "%d %d translate\n", pos_x, pos_y );
- // FT2 scales outlines to 26.6 pixels so the code below
- // should read 26600 instead of the 60000.
- fprintf(file, "%d 60000 div %d 60000 div scale\n", scale_x, scale_y );
- fprintf(file, "0 0 0 setrgbcolor\n");
-
- FT_Load_Glyph(face, glyph_index, load_flags);
- FT_Get_Glyph (face->glyph, &glyph);
- FT_Outline_Decompose (&(((FT_OutlineGlyph)glyph)->outline),
- &outlinefunc, &outline_info);
- fprintf(file, "closepath fill grestore \n");
-
- FT_Done_Glyph (glyph);
-}
-
-#endif
-
-void wxPostScriptDC::DoDrawText( const wxString& text, wxCoord x, wxCoord y )
-{
- wxCHECK_RET( m_ok && m_pstream, wxT("invalid postscript dc") );
-
-#if wxUSE_PANGO
- int dpi = GetResolution();
- dpi = 300;
- PangoContext *context = pango_ft2_get_context ( dpi, dpi );
-
- pango_context_set_language (context, pango_language_from_string ("en_US"));
- pango_context_set_base_dir (context, PANGO_DIRECTION_LTR );
-
- pango_context_set_font_description (context, m_font.GetNativeFontInfo()->description );
-
- PangoLayout *layout = pango_layout_new (context);
-#if wxUSE_UNICODE
- wxCharBuffer buffer = wxConvUTF8.cWC2MB( text );
-#else
- wxCharBuffer buffer = wxConvUTF8.cWC2MB( wxConvLocal.cWX2WC( text ) );
-#endif
- pango_layout_set_text( layout, (const char*) buffer, strlen(buffer) );
-
- PangoRectangle rect;
- pango_layout_get_extents(layout, NULL, &rect);
-
- int xx = x * PANGO_SCALE;
- int yy = y * PANGO_SCALE + (rect.height*2/3);
-
- int scale_x = LogicalToDeviceXRel( 1000 );
- int scale_y = LogicalToDeviceYRel( 1000 );
-
- // Loop over lines in layout
- int num_lines = pango_layout_get_line_count( layout );
- for (int i = 0; i < num_lines; i++)
- {
- PangoLayoutLine *line = pango_layout_get_line( layout, i );
-
- // Loop over runs in line
- GSList *runs_list = line->runs;
- while (runs_list)
- {
- PangoLayoutRun *run = (PangoLayoutRun*) runs_list->data;
- PangoItem *item = run->item;
- PangoGlyphString *glyphs = run->glyphs;
- PangoAnalysis *analysis = &item->analysis;
- PangoFont *font = analysis->font;
- FT_Face ft_face = pango_ft2_font_get_face(font);
-
- int num_glyphs = glyphs->num_glyphs;
- for (int glyph_idx = 0; glyph_idx < num_glyphs; glyph_idx++)
- {
- PangoGlyphGeometry geometry = glyphs->glyphs[glyph_idx].geometry;
- int pos_x = xx + geometry.x_offset;
- int pos_y = yy - geometry.y_offset;
- xx += geometry.width;
-
- draw_bezier_outline( m_pstream, ft_face,
- (FT_UInt)(glyphs->glyphs[glyph_idx].glyph),
- LogicalToDeviceX( pos_x / PANGO_SCALE ),
- LogicalToDeviceY( pos_y / PANGO_SCALE ),
- scale_x, scale_y );
- }
- runs_list = runs_list->next;
- }
- }
-
- g_object_unref( G_OBJECT( layout ) );
-#else
- wxCoord text_w, text_h, text_descent;
-
- GetTextExtent(text, &text_w, &text_h, &text_descent);
-
- // VZ: this seems to be unnecessary, so taking it out for now, if it
- // doesn't create any problems, remove this comment entirely
- //SetFont( m_font );