[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Word wrap for non-whitespace-seperated language

From: Yuan Fu
Subject: Re: Word wrap for non-whitespace-seperated language
Date: Thu, 5 Mar 2020 17:33:49 -0500

I wrote something that works. The goal is to have a word wrap effect for 
variable pitch words while breaking not only on white space characters but also 
between CJK characters. fill.el doesn’t work because it doesn’t work for 
variable pitch fonts, word-wrap doesn’t work because it can’t break between CJK 
characters. The key point is to find the place to break, my current method is 
forward char until the x position of point exceeds certain value (say 70*7 
pixels). This has two flaws: first, forward char-by-char is very slow, although 
I added some simple optimizations, the lag is still noticeable even with small 
paragraphs. Second, I can’t get the position of point if it goes out of the 
window, in which case I need to recenter. 

Is there a better way to search forward for a point such that it’s x position 
is larger than some value? (Come think of it, is it possible to find a point in 
a window by x-y coordinate?) Thanks.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]