#include <pango/pango.h>
#include <pango/pangoft2.h>
#include <ft2build.h>
Go to the source code of this file.
Defines | |
#define | PANGO_GLYPH_EMPTY ((PangoGlyph)0x0FFFFFFF) |
Functions | |
void | render_single_line (unsigned char *bmp, PangoLayoutLine *pango_line, unsigned int font_hash_code, int x, int y, const int width) |
Render 1 single pango line at (x,y). | |
void | render_single_glyph (unsigned char *bmp, int x, int y, const int width, const FT_BitmapGlyph glyph) |
Render 1 single glyph at (x,y). |
#define PANGO_GLYPH_EMPTY ((PangoGlyph)0x0FFFFFFF) |
Copyright (C) 2008 iRex Technologies B.V. All rights reserved.
Definition at line 37 of file pango_renderer.h.
Referenced by render_single_line().
void render_single_glyph | ( | unsigned char * | bmp, | |
int | x, | |||
int | y, | |||
const int | width, | |||
const FT_BitmapGlyph | glyph | |||
) |
Render 1 single glyph at (x,y).
Definition at line 83 of file pango_renderer.cpp.
Referenced by render_single_line().
00088 { 00089 unsigned char *src = glyph->bitmap.buffer; 00090 unsigned char *dst = bmp + y * width + x; 00091 00092 for(int i = 0; i < glyph->bitmap.rows; i++) 00093 { 00094 unsigned char *p = dst; 00095 for (int j = 0; j < glyph->bitmap.pitch; j++) 00096 { 00097 *p++ ^= *src++; 00098 } 00099 dst += width; 00100 } 00101 }
void render_single_line | ( | unsigned char * | bmp, | |
PangoLayoutLine * | pango_line, | |||
unsigned int | font_hash_code, | |||
int | x, | |||
int | y, | |||
const int | width | |||
) |
Render 1 single pango line at (x,y).
Copyright (C) 2008 iRex Technologies B.V. All rights reserved.
Definition at line 30 of file pango_renderer.cpp.
References data, FontCache::get_glyph(), FontCache::instance(), PANGO_GLYPH_EMPTY, and render_single_glyph().
Referenced by text::TextView::render().
00036 { 00037 // Draw run list . 00038 int glyph_pos_x = 0, glyph_pos_y = 0; 00039 GSList *runs_list = pango_line->runs; 00040 00041 FontCache& font_cache = FontCache::instance(); 00042 00043 // draw each pango run 00044 while (runs_list) 00045 { 00046 // Get glyph data. 00047 PangoLayoutRun *run = (PangoLayoutRun *)runs_list->data; 00048 PangoGlyphString *glyphs = run->glyphs; 00049 FT_Face ft_face = pango_fc_font_lock_face(PANGO_FC_FONT(run->item->analysis.font)); 00050 00051 // draw each glyph 00052 for (int i=0; i<glyphs->num_glyphs; i++) 00053 { 00054 PangoGlyphGeometry geometry = glyphs->glyphs[i].geometry; 00055 glyph_pos_x = x + geometry.x_offset; 00056 glyph_pos_y = y + geometry.y_offset; 00057 x += geometry.width; 00058 00059 if (glyphs->glyphs[i].glyph == PANGO_GLYPH_EMPTY) 00060 { 00061 continue; 00062 } 00063 00064 // load glyph bitmap and copy 00065 FT_BitmapGlyph data = font_cache.get_glyph(ft_face, 00066 font_hash_code, 00067 glyphs->glyphs[i].glyph); 00068 if (data) 00069 { 00070 render_single_glyph(bmp, 00071 PANGO_PIXELS(glyph_pos_x) + data->left, 00072 PANGO_PIXELS(glyph_pos_y) - data->top, 00073 width, 00074 data); 00075 } 00076 } 00077 00078 pango_fc_font_unlock_face(PANGO_FC_FONT(run->item->analysis.font)); 00079 runs_list = runs_list->next; 00080 } 00081 }