Commit Graph

89 Commits

Author SHA1 Message Date
George Sokianos 8fe3c75339 Fixes on renderer to address wrong colors with opacity smaller than 1 and wrong surface size, like mentioned at #803 issue at lite-xl repo 2022-02-05 13:31:40 +00:00
Adam Harrison bc5be3c9b7 Support no antialiasing. 2021-11-22 18:13:43 -05:00
Adam 4e26a9fb2d
Merge pull request #621 from adamharrison/fix-renderer-mappings
Handles occasions where our color bytes aren't in the order we expected.
2021-11-07 15:30:57 -05:00
Adam 90714c48e1
Update renderer.c
Upped limit to 1024.
2021-11-01 10:03:36 -04:00
Adam Harrison b7cb7e2b67 Just added MAX. More inline with other constant. 2021-10-31 13:34:46 -04:00
Adam Harrison 9e67995feb Expand glyphsets to accomodate emojis. 2021-10-31 13:27:51 -04:00
Adam Harrison 461533eabf Handles occasions where our color bytes aren't in the order we expected. 2021-10-20 18:43:22 -04:00
Adam 3f1378ab2e
Merge pull request #616 from adamharrison/font-groupings
Added in support for fallback font groupings.
2021-10-20 11:00:40 -04:00
Adam Harrison b816a04d27 Added in a missing static. 2021-10-17 00:39:08 -04:00
Adam Harrison 16fc15daee Allowed for a white square as part of the other groups. 2021-10-17 00:26:20 -04:00
Adam Harrison cab315bed1 Added in a rectdraw when a fallback glyph isn't present. 2021-10-17 00:22:27 -04:00
Adam Harrison c7c4a3c528 Clarified. 2021-10-17 00:10:40 -04:00
Adam Harrison d1fcdacacd Broke out font groupings. 2021-10-16 23:49:42 -04:00
Adam Harrison 3092dca919 Changed computation to take into account alpha blending. 2021-10-16 22:59:41 -04:00
Adam Harrison f2488fdd8d Added in support for font groupings. 2021-10-12 23:24:52 -04:00
Adam Harrison 7c1ff0f3d8 Fixed writing before clip. 2021-10-12 21:22:02 -04:00
Adam Harrison d2e16ce0b5 Fixed clip issues if glyph exists before clip.x 2021-10-11 22:29:53 -04:00
Adam Harrison fe787de97a Fixed clip boundaries. 2021-10-07 18:54:23 -04:00
Adam Harrison 26ec2d7090 Fixed negative pens. 2021-10-02 14:13:39 -04:00
Adam Harrison c5f60a7865 Fixed issues if one got into high codepoint ranges. 2021-10-01 23:56:36 -04:00
Adam Harrison 531cd3bedb Fixed issue with metrics. 2021-10-01 21:20:44 -04:00
Adam Harrison 7a21ec382f Unecessary call.. 2021-09-26 20:09:51 -04:00
Adam Harrison 4690459a13 Used different weights. 2021-09-26 19:46:32 -04:00
Adam Harrison b17aa3b068 Addressed issue where glyphs would continue to draw past their clip. 2021-09-25 00:45:19 -04:00
Adam Harrison 806e4bc970 Converted all ints to floats for x coordinate purposes. 2021-09-25 00:35:55 -04:00
Adam Harrison d07d0e6d22 Made width return a floating point. 2021-09-24 23:34:19 -04:00
Adam Harrison c5fda5237f Added in correcion calculations for surface_scale. 2021-09-24 11:23:49 -04:00
Adam Harrison 940db0f9c7 Added in underline as well. 2021-09-24 11:23:49 -04:00
Adam Harrison 16deedc8a3 Fixed up some naming conventions, and also added bolding and italics. 2021-09-24 11:23:49 -04:00
Adam Harrison e25f2e9c5c Removed font renderer. 2021-09-24 11:22:39 -04:00
Adam Harrison 214e6898df Reverted if guard. 2021-06-09 19:34:02 -04:00
Adam Harrison aa9f16c74c Added in #if guard for ARM achitectures. 2021-06-09 18:05:39 -04:00
Adam Harrison 29837d0c41 Replaced fill loop with SDL_FillRect. 2021-06-08 21:31:09 -04:00
Francesco Abbate 3d84fe5488 Make usage of SDL renderer optional 2021-04-29 14:15:24 +02:00
Francesco Abbate 7c79105d2f Fix missing scaling for update rects in renderer 2021-04-27 07:29:13 -07:00
Francesco Abbate 9486940082 Update the whole texture with RenderCopy 2021-04-27 15:21:23 +02:00
Francesco Abbate 67f431c69c Alternative texture update scheme 2021-04-27 14:04:02 +02:00
Francesco Abbate 0fe8415bb4 Add assert if font loading fails during rendering 2021-04-27 11:56:02 +02:00
Francesco Abbate 8b9fbecd74 Ensure we update only modified rects 2021-04-27 09:52:02 +02:00
Francesco Abbate 46c3bdea67 First implementation of scaling for retina display
Introduce a new approach that discriminate coordinates in
points and pixels. Now all the logic from the Lua side and in
rencache is to always use points. The coordinates are converted
to pixels only within the renderer, in the file renderer.c.
In this way the application logic does not need to care about the
scaling of the retina displays.

For non-retina display the scaling between points and pixels is
equal to one so nothing will change.

There is nevertheless a change that leak into the Lua side. The
subpixel coordinates are in sub-pixel, not sub-points so they are
scaled by the retina scaling factor. But no change in the code is
required because the subpixel scaling factor take into account the
retina scaling, when present.

Because the retina scaling factor is not know when the application
starts but only when a window is actually available we introduce a
mechanism to render the font with a given scaling factor only from
the renderer when they are needed. We use therefore FontDesc to
describe the font information but without actually rasterizing the
font at a given scale.
2021-04-26 15:16:34 +02:00
Francesco Abbate 57e6de978b Fix error with missing ren_resize call 2021-04-23 07:09:50 -07:00
Francesco Abbate 33fe7295c0 First working implemention
Cleanup also debug messages
2021-04-23 14:54:25 +02:00
Francesco Abbate 685b8c82d0 WIP: testing usage of SDL renderer
It does segfault.
2021-04-23 11:58:53 +02:00
Francesco Abbate 3b040aabc7 Implement unicode character replacements
Useful to draw whitespaces with alternate characters and colors
without slowing down the text rendering.

A new API is implemented. A renderer.replacements object can be created
to list the replacements.

In turns the function renderer.draw_text and draw_text_subpixel now accept
two optional arguments for replacements.
2021-04-01 18:05:59 +02:00
Francesco Abbate e160ed4e5e Add comments about unused RenFont data field 2021-03-20 23:05:09 +01:00
Francesco Abbate b33167ca4b Revert "Remove unused data field in RenFont"
This reverts commit 461266e97d.

Related to github issue #122.

The void *data field is not used but the glyphset index can
someting be equal to -1 and the unused field prevent faulty
writes before the allocated struct.
2021-03-20 21:48:04 +01:00
Francesco Abbate 461266e97d Remove unused data field in RenFont 2021-03-18 14:05:58 +01:00
Francesco Abbate 88bec172a1 Fix problem with tab size and subpixel positioning
Solve github issue https://github.com/franko/lite-xl/issues/109
2021-03-18 13:54:33 +01:00
Francesco Abbate 3426bc5d73 Introduce subpixel text positioning within rencache
In order to fix the issue with cursor positioning a subpixel-aware draw
text operation within rencache was required.

With this modification the cursor positioning problem is completely
resolved.

A new function renderer.draw_text_subpixel is introduced to perform
consecutive, inline, text drawings with subpixel accuracy.
2021-03-06 18:12:02 +01:00
Francesco Abbate 9ff6a0325e Mostly fix problem of offset with cursor positioning when using mouse
In order to get right the cursor position on text on mouse clicks it is
needed to take into account text's subpixel positioning.

This fix mostly corrects the problem but cursor positioning is still
somewhat inaccurate for long lines due to repeated commands to draw a text
along a line. Repeated draw text calls make the subpixel information
lost and small errors will add-up.
2021-03-06 16:18:24 +01:00