mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-10-21 12:42:25 +00:00
...
This commit is contained in:
parent
8dd6686c86
commit
aae50f9a99
2 changed files with 4 additions and 3 deletions
|
|
@ -1728,8 +1728,9 @@ get_fallback_font(PyObject UNUSED *self, PyObject *args) {
|
|||
int bold, italic;
|
||||
if (!PyArg_ParseTuple(args, "Upp", &text, &bold, &italic)) return NULL;
|
||||
GPUCell gpu_cell = {0};
|
||||
RAII_ListOfChars(lc); ensure_space_for_chars(&lc, PyUnicode_GetLength(text));
|
||||
if (!PyUnicode_AsUCS4(text, lc.chars, lc.count, 1)) return NULL;
|
||||
RAII_ListOfChars(lc); lc.count = PyUnicode_GET_LENGTH(text);
|
||||
ensure_space_for_chars(&lc, lc.count);
|
||||
if (!PyUnicode_AsUCS4(text, lc.chars, lc.capacity, 1)) return NULL;
|
||||
if (bold) gpu_cell.attrs.bold = true;
|
||||
if (italic) gpu_cell.attrs.italic = true;
|
||||
FontGroup *fg = font_groups;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ ensure_space_for_chars(ListOfChars *lc, size_t count) {
|
|||
lc->capacity = count + LIST_OF_CHARS_STACK_SIZE;
|
||||
void *chars = malloc(lc->capacity * sizeof(lc->chars[0]));
|
||||
if (!chars) fatal("Out of memory allocating LCChars char space");
|
||||
memcpy(chars, lc->chars, MIN(lc->count, LIST_OF_CHARS_STACK_SIZE) * sizeof(lc->chars[0]));
|
||||
memcpy(chars, lc->chars, LIST_OF_CHARS_STACK_SIZE * sizeof(lc->chars[0]));
|
||||
lc->chars = chars;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue