-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[issue 460] Support variable-width text #1608
base: master
Are you sure you want to change the base?
Conversation
Updated from 2011 patch by fjakobs: ajaxorg@36ebe6c * removes old double-width CJK handling * replaces monospace assumptions with measurements of actual text * appears to work for Latin, CJK, Thai, Malayalam in ad-hoc testing * does NOT fully handle RTL text issues (Hebrew, Arabic)
var space = new Array(c.length+1).join(self.SPACE_CHAR); | ||
return "<span class='ace_invisible'>" + space + "</span>"; | ||
} else { | ||
return " "; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use self.SPACE_CHAR
here and above? (Please note that I came here from MediaWiki bug 54136 and I have no idea how this code works, just reading the changes :) )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm reading things right, SPACE_CHAR is the replacement character to be used in "show invisibles" mode -- it's a mid-dot character. Non-breaking space ( ) sounds right for non-showing mode.
Testing on the kitchen sink page on Opera 12, this seems to break cursor positioning in funny ways when I enable soft wrap. |
Yeah, multiline / soft wrap doesn't work (per notes on the original patch), we may just have to live with that for Wikipedia for now but that'd be nice to fix proper... there's also a problem with the tab character that definitely needs fixing. |
Thank you very much for updating this patch!
also i think cursor movement isn't quite right for languages like Tamil, but it can be fixed later. |
Awesome!
|
@Brion Thanks for reviving my varchar patch. The tricky part about the monospace fast path is to detect if the font is really monospace. Also with the varchar patch in place we can finally allow bold styles and different fonts in the themes. If that is used it would be very hard to implement a proper fast path. As for softwrap + varchar: I think it can be done but it might become fairly expensive. Finding an efficient solution will be tricky. We can't unfortunately move that computation into a worker because measuring sizes requires DOM access. We could start by assuming monospace and only if the text comes into view reflow the visible areas with the real text sizes. |
This pull request completely solves my problems with inserting unicode math symbols that are not supported by monospace fonts. I would really like to use this patch at websites like stackedit.io or sharelatex.com. I asked sharelatex.com if it possible to use this patch, but they are waiting until this patch is merged. About problem 3), what about adding an option |
@@ -1348,15 +1350,47 @@ var VirtualRenderer = function(container, theme) { | |||
return {row: row, column: col, side: offset - col > 0 ? 1 : -1}; | |||
}; | |||
|
|||
this.$findColumn = function(row, width) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me like this functionality would make more sense inside the TextLayer itself. The rendered would instead ask the TextLayer what column and row a particular x,y belong to. You could add an alternative iteration/exit condition of measureText that would measure up to a given width and return the column.
Is there any hope of getting this patch merged? I need to support various unicode character (diacritics, telugu, hindi, etc) and this is constantly biting me. It really becomes impossible to use the editor in these circumstances. This patch seems to fix the problem. Really appreciate the work @Brion and @fjakobs have done on this. +1 to get this finished up and merged |
+1 to getting this merged. Pretty please? |
This doesn't work with showInvisibles, tab characters, and wrapped lines, first two issues are easy to fix, but wrapping requires more work. Would this be useful for you without wrapping support? |
@nightwing Yes, but wrapping support is also a must-have, at least for us. Thanks for your quick response :) |
If you can point me in the right direction, I might be able to lend a hand fixing wrapping. |
@camertron any help would be welcome of course. |
Updated from 2011 patch by fjakobs:
36ebe6c