aboutsummaryrefslogtreecommitdiff
path: root/data/plugins/language_cpp.lua
diff options
context:
space:
mode:
authorTakase <20792268+takase1121@users.noreply.github.com>2024-07-13 08:39:49 +0800
committerjgmdev <jgmdev@gmail.com>2024-07-13 21:32:59 -0400
commit44e847691cef744dff590ffcf18a1b99d49a2333 (patch)
tree5675967b0397d07ccb95c2101d4cb7bcc9e03e9f /data/plugins/language_cpp.lua
parent018bf05eb92b3e25ee179e88e575610d33290834 (diff)
downloadpragtical-44e847691cef744dff590ffcf18a1b99d49a2333.tar.gz
pragtical-44e847691cef744dff590ffcf18a1b99d49a2333.zip
rebase: renderer rewrite glyph cache (lite-xl/lite-xl#1845)
* renderer: rewrite glyph cache This commit splits the current GlyphSet-based system into 2 caches, CharMap and GlyphMap, which maps codepoints -> glyph IDs and glyph IDs -> glyphs respectively. Each GlyphMap contains a number of GlyphAtlas mapped by their width, and each GlyphAtlas has a list of surfaces with the same width. Surfaces within the GlyphAtlas acts like a bump allocator, but is flexible enough to allow older GlyphAtlas surfaces to be recycled. GlyphMetric now contains atlas_idx and surface_idx, which points to the correct surface. Since GlyphAtlas supports rudimentary packing & allocation, we no longer render whole GlyphSets and this speeds up rendering in most cases. Tab width is no longer set with the hacky "modify the GlyphMetric" hack. * renderer: set natlas to 0 after freeing * renderer: fix printf warning * renderer: fix memory leak * renderer: better whitespace rendering * renderer: fix ubsan warning when casting ints * renderer: fix tab handling There's a bug with inconsistent tab widths caused by fontgroups. * renderer: fix glyphs being loaded over and over * renderer: add glyphmap size * renderer: store per-surface offset_y and use it to find best-fitting surface * renderer: fix MSVC compiler error * renderer: remove return value from ren_font_glyph * renderer: refactor xadvance calculation * renderer: fix double free SDL_RWops if FT_Set_Pixel_Size fail * renderer: always try .notdef before U+25A1 * renderer: disable ren_font_dump yet again Accidentally commited this change. * renderer: remove unused imports * renderer: fix double free with FT_Open_Face * renderer: return SDL_Surface in font_find_glyph_surface * renderer: bring back metric flags for future extension * renderer: refactor xadvance calculation into macro * renderer: fix comment * renderer: store GlyphMetric directly in the surface * renderer: remove duplicated comment * renderer: rename font_find_glyph_surface to font_allocate_glyph_surface * renderer: refactor glyphmetric retrieval into an inline function * renderer: do not render glyphs with bitmap set to null This is a weird edge case, but at least it shouldn't crash * renderer: refactor face metric code into its own function * renderer: actually check if glyph fits in surface * renderer: rudimentary support for non-scalable faces At least it won't render nothing on the screen * renderer: check for font_surface instead of metric directly This is safe and shorter * renderer: fix indentation * renderer: rename GLYPH_PER_ATLAS to GLYPHS_PER_ATLAS * renderer: rename all GLYPH_PER_ATLAS correctly * renderer: make utf8_to_codepoint slightly more durable * renderer: fix compiler unsigned cast warning
Diffstat (limited to 'data/plugins/language_cpp.lua')
0 files changed, 0 insertions, 0 deletions