}
fprintf(out, "\t{ /* %d 0x%x */\n"
+ "\t\t.width = %d,\n"
"\t\t.buf = {\n"
"\t\t\t.width = %d,\n"
"\t\t\t.height = 16,\n"
"\t\t\t.stride = %d,\n"
"\t\t\t.format = UTERM_FORMAT_GREY,\n"
"\t\t\t.data = (uint8_t[]){\n",
- g->codepoint, g->codepoint,
+ g->codepoint, g->codepoint, 1,
width * 4, width * 4);
for (i = 0; i < g->len; ++i) {
FT_Bitmap *bmap;
FT_GlyphSlot slot;
bool res;
- unsigned int i, j, wmax, hmax, idx1, idx2;
+ unsigned int i, j, wmax, hmax, idx1, idx2, cwidth;
int ret, hoff1, hoff2, woff1, woff2;
+ if (!len)
+ return -ERANGE;
+ cwidth = tsm_ucs4_get_width(*ch);
+ if (!cwidth)
+ return -ERANGE;
+
pthread_mutex_lock(&face->glyph_lock);
res = shl_hashtable_find(face->glyphs, (void**)&glyph,
(void*)(long)id);
memset(glyph, 0, sizeof(*glyph) + sizeof(struct glyph));
glyph->data = (void*)(((uint8_t*)glyph) + sizeof(*glyph));
data = glyph->data;
+ glyph->width = cwidth;
/* We currently ignore composed-symbols. That is, we only use the first
* UCS-4 code and draw this character. This works great for most simple
}
data->width = bmap->width;
- glyph->buf.width = face->real_attr.width;
+ glyph->buf.width = face->real_attr.width * cwidth;
glyph->buf.height = face->real_attr.height;
glyph->buf.stride = glyph->buf.width;
glyph->buf.format = UTERM_FORMAT_GREY;
int ret;
static const uint32_t question_mark = '?';
+ face->empty.width = 1;
face->empty.data = NULL;
face->empty.buf.width = face->real_attr.width;
face->empty.buf.height = face->real_attr.height;
data = glyph->data;
if (face->shrink && !data->shrinked) {
data->shrinked = true;
- glyph->buf.width = face->real_attr.width;
+ glyph->buf.width = face->real_attr.width * glyph->width;
}
*out = glyph;
PangoRectangle rec;
PangoLayoutLine *line;
FT_Bitmap bitmap;
+ unsigned int cwidth;
size_t ulen, cnt;
char *val;
bool res;
int ret;
+ if (!len)
+ return -ERANGE;
+ cwidth = tsm_ucs4_get_width(*ch);
+ if (!cwidth)
+ return -ERANGE;
+
pthread_mutex_lock(&face->glyph_lock);
res = shl_hashtable_find(face->glyphs, (void**)&glyph,
(void*)(long)id);
goto out_unlock;
}
memset(glyph, 0, sizeof(*glyph));
+ glyph->width = cwidth;
layout = pango_layout_new(face->ctx);
line = pango_layout_get_line_readonly(layout, 0);
pango_layout_line_get_pixel_extents(line, NULL, &rec);
- glyph->buf.width = face->real_attr.width;
+ glyph->buf.width = face->real_attr.width * cwidth;
glyph->buf.height = face->real_attr.height;
glyph->buf.stride = glyph->buf.width;
glyph->buf.format = UTERM_FORMAT_GREY;