font_freetype2: fix log messages
Use LOG_SUBSYSTEM and remove newlines. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
parent
668052401e
commit
c4716ad6ce
@ -35,7 +35,6 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
#include "gl.h"
|
#include "gl.h"
|
||||||
@ -45,6 +44,8 @@
|
|||||||
#include <ft2build.h>
|
#include <ft2build.h>
|
||||||
#include FT_FREETYPE_H
|
#include FT_FREETYPE_H
|
||||||
|
|
||||||
|
#define LOG_SUBSYSTEM "font_freetype2"
|
||||||
|
|
||||||
struct kmscon_font_factory {
|
struct kmscon_font_factory {
|
||||||
unsigned long ref;
|
unsigned long ref;
|
||||||
FT_Library lib;
|
FT_Library lib;
|
||||||
@ -172,8 +173,6 @@ int kmscon_font_factory_new(struct kmscon_font_factory **out)
|
|||||||
if (!out)
|
if (!out)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
log_debug("font: new font factory\n");
|
|
||||||
|
|
||||||
ff = malloc(sizeof(*ff));
|
ff = malloc(sizeof(*ff));
|
||||||
if (!ff)
|
if (!ff)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@ -183,11 +182,12 @@ int kmscon_font_factory_new(struct kmscon_font_factory **out)
|
|||||||
|
|
||||||
err = FT_Init_FreeType(&ff->lib);
|
err = FT_Init_FreeType(&ff->lib);
|
||||||
if (err) {
|
if (err) {
|
||||||
log_warn("font: cannot initialize FreeType library\n");
|
log_warn("cannot initialize FreeType library");
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
goto err_free;
|
goto err_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log_debug("new font factory");
|
||||||
*out = ff;
|
*out = ff;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -215,11 +215,11 @@ void kmscon_font_factory_unref(struct kmscon_font_factory *ff)
|
|||||||
if (--ff->ref)
|
if (--ff->ref)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
log_debug("font: destroying font factory\n");
|
log_debug("destroying font factory");
|
||||||
|
|
||||||
err = FT_Done_FreeType(ff->lib);
|
err = FT_Done_FreeType(ff->lib);
|
||||||
if (err)
|
if (err)
|
||||||
log_warn("font: cannot deinitialize FreeType library\n");
|
log_warn("cannot deinitialize FreeType library");
|
||||||
|
|
||||||
free(ff);
|
free(ff);
|
||||||
}
|
}
|
||||||
@ -239,7 +239,7 @@ int kmscon_font_factory_load(struct kmscon_font_factory *ff,
|
|||||||
if (!width)
|
if (!width)
|
||||||
width = height;
|
width = height;
|
||||||
|
|
||||||
log_debug("font: loading new font %s\n", path);
|
log_debug("loading new font %s", path);
|
||||||
|
|
||||||
font = malloc(sizeof(*font));
|
font = malloc(sizeof(*font));
|
||||||
if (!font)
|
if (!font)
|
||||||
@ -256,20 +256,20 @@ int kmscon_font_factory_load(struct kmscon_font_factory *ff,
|
|||||||
if (err == FT_Err_Unknown_File_Format)
|
if (err == FT_Err_Unknown_File_Format)
|
||||||
estr = "unknown file format";
|
estr = "unknown file format";
|
||||||
|
|
||||||
log_warn("font: cannot load font: %s\n", estr);
|
log_warn("cannot load font: %s", estr);
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
goto err_free;
|
goto err_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!font->face->charmap) {
|
if (!font->face->charmap) {
|
||||||
log_warn("font: cannot load charmap of new font\n");
|
log_warn("cannot load charmap of new font");
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
goto err_face;
|
goto err_face;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = FT_Set_Pixel_Sizes(font->face, width, height);
|
err = FT_Set_Pixel_Sizes(font->face, width, height);
|
||||||
if (err) {
|
if (err) {
|
||||||
log_warn("font: cannot set pixel size of font\n");
|
log_warn("cannot set pixel size of font");
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
goto err_face;
|
goto err_face;
|
||||||
}
|
}
|
||||||
@ -310,7 +310,7 @@ void kmscon_font_unref(struct kmscon_font *font)
|
|||||||
if (--font->ref)
|
if (--font->ref)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
log_debug("font: destroying font\n");
|
log_debug("destroying font");
|
||||||
|
|
||||||
g_hash_table_unref(font->glyphs);
|
g_hash_table_unref(font->glyphs);
|
||||||
FT_Done_Face(font->face);
|
FT_Done_Face(font->face);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user