src/font.c

changeset 154
4dff9cc488fe
parent 149
560772519ff9
equal deleted inserted replaced
153:4116e2bd501b 154:4dff9cc488fe
80 cxListFree(asc_font_cache); 80 cxListFree(asc_font_cache);
81 } 81 }
82 82
83 TTF_Font *asc_font_load(AscFont font) { 83 TTF_Font *asc_font_load(AscFont font) {
84 // apply the UI scaling factor first to get the actual font size 84 // apply the UI scaling factor first to get the actual font size
85 if (asc_context.ui_scale != 1.f) { 85 const float ui_scale = asc_active_window->ui_scale;
86 font.size = (int) roundf((float) font.size * asc_context.ui_scale); 86 if (ui_scale != 1.f) {
87 font.size = (int) roundf((float) font.size * ui_scale);
87 } 88 }
88 89
89 CxIterator iter = cxListIterator(asc_font_cache); 90 CxIterator iter = cxListIterator(asc_font_cache);
90 cx_foreach(struct asc_font_cache_entry*, cache, iter) { 91 cx_foreach(struct asc_font_cache_entry*, cache, iter) {
91 if (cache->font.style == font.style && cache->font.size == font.size) { 92 if (cache->font.style == font.style && cache->font.size == font.size) {

mercurial