#include "titlerwindow.h"
#include "transportque.h"
#include "vrender.h"
-
+#include "workarounds.h"
#include <errno.h>
#include <stdint.h>
GlyphUnit::~GlyphUnit()
{
if( freetype_library )
- FT_Done_FreeType(freetype_library);
+ ft_Done_FreeType(freetype_library);
}
static inline void to_mono(VFrame *data)
result = 1;
}
if( !result ) {
- int gindex = FT_Get_Char_Index(freetype_face, glyph->char_code);
+ int gindex = ft_Get_Char_Index(freetype_face, glyph->char_code);
if( !gindex && !freetype_face->charmap && // if no default charmap
freetype_face->charmaps && freetype_face->charmaps[0] &&
- !FT_Select_Charmap(freetype_face, freetype_face->charmaps[0]->encoding) ) {
- gindex = FT_Get_Char_Index(freetype_face, glyph->char_code);
+ !ft_Select_Charmap(freetype_face, freetype_face->charmaps[0]->encoding) ) {
+ gindex = ft_Get_Char_Index(freetype_face, glyph->char_code);
}
if( gindex == 0 ) {
printf("GlyphUnit::process_package 1 glyph not found (%s) %04x, '%c'\n",
if( resources->find_font_by_char(glyph->char_code, new_path, freetype_face) ) {
plugin->load_freetype_face(freetype_library,
freetype_face, new_path);
- gindex = FT_Get_Char_Index(freetype_face, glyph->char_code);
+ gindex = ft_Get_Char_Index(freetype_face, glyph->char_code);
}
}
- FT_Set_Pixel_Sizes(freetype_face, glyph->size, 0);
+ ft_Set_Pixel_Sizes(freetype_face, glyph->size, 0);
if( gindex == 0 ) {
// carrige return
FT_Glyph glyph_image;
FT_BBox bbox;
FT_Bitmap bm;
- FT_Load_Glyph(freetype_face, gindex, FT_LOAD_DEFAULT);
- FT_Get_Glyph(freetype_face->glyph, &glyph_image);
- FT_Outline_Get_BBox(&((FT_OutlineGlyph) glyph_image)->outline, &bbox);
+ ft_Load_Glyph(freetype_face, gindex, FT_LOAD_DEFAULT);
+ ft_Get_Glyph(freetype_face->glyph, &glyph_image);
+ ft_Outline_Get_BBox(&((FT_OutlineGlyph) glyph_image)->outline, &bbox);
// printf("Stroke: Xmin: %ld, Xmax: %ld, Ymin: %ld, yMax: %ld\n",
// bbox.xMin,bbox.xMax, bbox.yMin, bbox.yMax);
glyph->data = new VFrame(glyph->width, glyph->height, BC_A8, glyph->pitch);
glyph->data->clear_frame();
bm.buffer = glyph->data->get_data();
- FT_Outline_Translate(&((FT_OutlineGlyph) glyph_image)->outline,
+ ft_Outline_Translate(&((FT_OutlineGlyph) glyph_image)->outline,
- bbox.xMin, - bbox.yMin);
- FT_Outline_Get_Bitmap( freetype_library,
+ ft_Outline_Get_Bitmap( freetype_library,
&((FT_OutlineGlyph) glyph_image)->outline,
&bm);
- FT_Done_Glyph(glyph_image);
+ ft_Done_Glyph(glyph_image);
}
else {
// Outline desired and glyph found
FT_BBox bbox;
FT_UInt npoints, ncontours;
- FT_Load_Glyph(freetype_face, gindex, FT_LOAD_DEFAULT);
- FT_Get_Glyph(freetype_face->glyph, &glyph_image);
+ ft_Load_Glyph(freetype_face, gindex, FT_LOAD_DEFAULT);
+ ft_Get_Glyph(freetype_face->glyph, &glyph_image);
// check if the outline is ok (non-empty);
- FT_Outline_Get_BBox(&((FT_OutlineGlyph) glyph_image)->outline, &bbox);
+ ft_Outline_Get_BBox(&((FT_OutlineGlyph) glyph_image)->outline, &bbox);
if( bbox.xMin == 0 && bbox.xMax == 0 &&
bbox.yMin == 0 && bbox.yMax == 0 ) {
- FT_Done_Glyph(glyph_image);
+ ft_Done_Glyph(glyph_image);
glyph->width = 0; glyph->height = 0;
glyph->left = 0; glyph->top = 0;
glyph->right = 0; glyph->bottom = 0;
return;
}
#if FREETYPE_MAJOR > 2 || (FREETYPE_MAJOR == 2 && FREETYPE_MINOR >= 2)
- FT_Stroker_New(freetype_library, &stroker);
+ ft_Stroker_New(freetype_library, &stroker);
#else
- FT_Stroker_New(((FT_LibraryRec *)freetype_library)->memory, &stroker);
+ ft_Stroker_New(((FT_LibraryRec *)freetype_library)->memory, &stroker);
#endif
- FT_Stroker_Set(stroker, (int)(plugin->config.stroke_width * 64),
+ ft_Stroker_Set(stroker, (int)(plugin->config.stroke_width * 64),
FT_STROKER_LINECAP_ROUND, FT_STROKER_LINEJOIN_ROUND, 0);
- FT_Stroker_ParseOutline(stroker, &((FT_OutlineGlyph) glyph_image)->outline,1);
- FT_Stroker_GetCounts(stroker,&npoints, &ncontours);
+ ft_Stroker_ParseOutline(stroker, &((FT_OutlineGlyph) glyph_image)->outline,1);
+ ft_Stroker_GetCounts(stroker,&npoints, &ncontours);
if( npoints == 0 && ncontours == 0 ) {
// this never happens, but FreeType has a bug regarding Linotype's Palatino font
- FT_Stroker_Done(stroker);
- FT_Done_Glyph(glyph_image);
+ ft_Stroker_Done(stroker);
+ ft_Done_Glyph(glyph_image);
glyph->width = 0; glyph->height = 0;
glyph->left = 0; glyph->top = 0;
glyph->right = 0; glyph->bottom = 0;
return;
};
- FT_Outline_New(freetype_library, npoints, ncontours, &outline);
+ ft_Outline_New(freetype_library, npoints, ncontours, &outline);
outline.n_points=0;
outline.n_contours=0;
- FT_Stroker_Export (stroker, &outline);
- FT_Outline_Get_BBox(&outline, &bbox);
- FT_Outline_Translate(&outline, - bbox.xMin, - bbox.yMin);
- FT_Outline_Translate(&((FT_OutlineGlyph) glyph_image)->outline,
+ ft_Stroker_Export(stroker, &outline);
+ ft_Outline_Get_BBox(&outline, &bbox);
+ ft_Outline_Translate(&outline, - bbox.xMin, - bbox.yMin);
+ ft_Outline_Translate(&((FT_OutlineGlyph) glyph_image)->outline,
- bbox.xMin,
- bbox.yMin + (int)(plugin->config.stroke_width*32));
// printf("Stroke: Xmin: %ld, Xmax: %ld, Ymin: %ld, yMax: %ld\n"
glyph->data_stroke->clear_frame();
// for debugging memset( glyph->data_stroke->get_data(), 60, glyph->pitch * glyph->height);
bm.buffer=glyph->data->get_data();
- FT_Outline_Get_Bitmap( freetype_library,
+ ft_Outline_Get_Bitmap( freetype_library,
&((FT_OutlineGlyph) glyph_image)->outline,
&bm);
bm.buffer=glyph->data_stroke->get_data();
- FT_Outline_Get_Bitmap( freetype_library,
+ ft_Outline_Get_Bitmap( freetype_library,
&outline,
&bm);
- FT_Outline_Done(freetype_library,&outline);
- FT_Stroker_Done(stroker);
- FT_Done_Glyph(glyph_image);
+ ft_Outline_Done(freetype_library,&outline);
+ ft_Stroker_Done(stroker);
+ ft_Done_Glyph(glyph_image);
//printf("GlyphUnit::process_package 2\n");
}
delete glyph_engine;
delete title_engine;
if( freetype_face )
- FT_Done_Face(freetype_face);
+ ft_Done_Face(freetype_face);
if( freetype_library )
- FT_Done_FreeType(freetype_library);
+ ft_Done_FreeType(freetype_library);
delete translate;
delete outline_engine;
}
// (char *)new_path);
strcpy(new_path, font->path);
if( load_freetype_face(freetype_library, freetype_face, new_path)) continue;
- FT_Set_Pixel_Sizes(freetype_face, text_height, 0);
- if( FT_Load_Char(freetype_face, c, FT_LOAD_RENDER) ) continue;
+ ft_Set_Pixel_Sizes(freetype_face, text_height, 0);
+ if( ft_Load_Char(freetype_face, c, FT_LOAD_RENDER) ) continue;
int glyph_w = freetype_face->glyph->bitmap.width;
int glyph_h = freetype_face->glyph->bitmap.rows;
if( glyph_h > max_height ) glyph_h = max_height;
}
}
- if( freetype_library ) FT_Done_FreeType(freetype_library);
+ if( freetype_library ) ft_Done_FreeType(freetype_library);
}
FcConfig *config;
FcPattern *font;
- FcInit();
- config = FcConfigGetCurrent();
- FcConfigSetRescanInterval(config, 0);
+ fcInit();
+ config = fcConfigGetCurrent();
+ fcConfigSetRescanInterval(config, 0);
- pat = FcPatternCreate();
- os = FcObjectSetBuild ( FC_FILE, FC_FONTFORMAT, (char *) 0);
- fs = FcFontList(config, pat, os);
+ pat = fcPatternCreate();
+ os = fcObjectSetBuild( FC_FILE, FC_FONTFORMAT, (char *) 0);
+ fs = fcFontList(config, pat, os);
int found = 0;
char tmpstring[BCTEXTLEN];
int limit_to_truetype = 0; //if you want to limit search to truetype put 1
- if( !freetype_library ) FT_Init_FreeType(&freetype_library);
- if( !FT_New_Face(freetype_library, path_old, 0, &temp_freetype_face) ) {
- FT_Set_Pixel_Sizes(temp_freetype_face, 128, 0);
- int gindex = FT_Get_Char_Index(temp_freetype_face, char_code);
+ if( !freetype_library ) ft_Init_FreeType(&freetype_library);
+ if( !ft_New_Face(freetype_library, path_old, 0, &temp_freetype_face) ) {
+ ft_Set_Pixel_Sizes(temp_freetype_face, 128, 0);
+ int gindex = ft_Get_Char_Index(temp_freetype_face, char_code);
if( gindex != 0 && char_code == 10 ) {
strcpy(path_new, path_old);
found = 1;
if( !found ) {
for( int i=0; fs && i<fs->nfont; ++i ) {
font = fs->fonts[i];
- FcPatternGetString(font, FC_FONTFORMAT, 0, &format);
+ fcPatternGetString(font, FC_FONTFORMAT, 0, &format);
if( strcmp((char *)format, "TrueType") && !limit_to_truetype ) continue;
- if( FcPatternGetString(font, FC_FILE, 0, &file) != FcResultMatch ) continue;
+ if( fcPatternGetString(font, FC_FILE, 0, &file) != FcResultMatch ) continue;
sprintf(tmpstring, "%s", file);
- if( !FT_New_Face(freetype_library, tmpstring, 0, &temp_freetype_face) ) continue;
- FT_Set_Pixel_Sizes(temp_freetype_face, 128, 0);
- int gindex = FT_Get_Char_Index(temp_freetype_face, char_code);
+ if( !ft_New_Face(freetype_library, tmpstring, 0, &temp_freetype_face) ) continue;
+ ft_Set_Pixel_Sizes(temp_freetype_face, 128, 0);
+ int gindex = ft_Get_Char_Index(temp_freetype_face, char_code);
if( gindex != 0 && char_code == 10 ) {
sprintf(path_new, "%s", tmpstring);
found = 1;
}
done:
- if( fs ) FcFontSetDestroy(fs);
- if( temp_freetype_face ) FT_Done_Face(temp_freetype_face);
+ if( fs ) fcFontSetDestroy(fs);
+ if( temp_freetype_face ) ft_Done_Face(temp_freetype_face);
temp_freetype_face = 0;
if( !found ) {
{
//printf("TitleMain::load_freetype_face 1\n");
if( !freetype_library )
- FT_Init_FreeType(&freetype_library);
+ ft_Init_FreeType(&freetype_library);
if( freetype_face )
- FT_Done_Face(freetype_face);
+ ft_Done_Face(freetype_face);
freetype_face = 0;
//printf("TitleMain::load_freetype_face 2\n");
// Use freetype's internal function for loading font
- if( FT_New_Face(freetype_library, path, 0, &freetype_face) ) {
+ if( ft_New_Face(freetype_library, path, 0, &freetype_face) ) {
fprintf(stderr, _("TitleMain::load_freetype_face %s failed.\n"), path);
freetype_face = 0;
freetype_library = 0;
int result = cur->advance_x;
if( !nxt ) return result;
FT_Vector kerning;
- if( !FT_Get_Kerning(freetype_face,
+ if( !ft_Get_Kerning(freetype_face,
cur->freetype_index, nxt->freetype_index,
ft_kerning_default, &kerning) )
result += (kerning.x >> 6);
title_glyphs.clear();
title_images.clear();
if( freetype_face ) {
- FT_Done_Face(freetype_face);
+ ft_Done_Face(freetype_face);
freetype_face = 0;
}
}
int TitleMain::init_freetype()
{
if( !freetype_library )
- FT_Init_FreeType(&freetype_library);
+ ft_Init_FreeType(&freetype_library);
return 0;
}