Giter Site home page Giter Site logo

Display: Unicode space issues about jimud HOT 4 CLOSED

icewolfz avatar icewolfz commented on May 28, 2024
Display: Unicode space issues

from jimud.

Comments (4)

icewolfz avatar icewolfz commented on May 28, 2024

Seems the issue is when certain Unicode characters take up 2 spaces, http://denisbider.blogspot.com/2015/09/when-monospace-fonts-arent-unicode.html only real fix is to add in variable width support which may or may not add some extra slowdown as line spacing is only calculated once when added or when font changed

from jimud.

icewolfz avatar icewolfz commented on May 28, 2024

Using the canvas measure text function does help fix this to a point, it reduces some of the overhead of using DOM, the issues that remain with variable width are correct hit testing to correctly draw selection rectangles for proper text copy/paste as different format blocks effect the alignment of text as measuring a string as one long block of text is different then measuring it in split up blocks. The only real correct way to handle is parse each line looping each format block and measuring the width to determine if it is in the desired "block" of text this may reduce performance and drive up cpu on text selection

from jimud.

icewolfz avatar icewolfz commented on May 28, 2024

Sample text, should be spaced out nicely
${esc}m[32mQ${esc}m[33mR${esc}m[34mS${esc}m[35m1${esc}m[36m2
QRS12

from jimud.

icewolfz avatar icewolfz commented on May 28, 2024

Seems it was not fixed 100%, while it fixed most of the overlapping issues there are still some width calculation issues for some Unicode groups, #testutf8 command will display some of the broken widths seen by selecting text, i have a more accurate way to determine text size but is is nearly 2 to 3 times slower then v0.6.1 fix taking nearly 1200ms on avg to run the #textspeed while the v0.6.1 is roughly 600ms on avg. I can not think of a good way to get performance and accurate text widths due to limitations in web tech, you either use the slower more accurate system or the faster less accurate system

from jimud.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.