Replies: 4 comments 4 replies
-
I hope this is the right place to ask the above question. Just to be more specific, I have no experience with Javascript or how it can be used in txs macros, so I am looking for a way to make this macro. To give a clearer impression of it, I have indicated below a possible substitution procedure: (a) for i='\u0021'; i<='\u007E'; i++ do replace with '\uFF01' (until \uFF5E) --- This involves punctuation and latin alfanumerics (b) for i='\u0020' do replace with '\u3000' --- This is the empty space (c) for \u00A2 , \u00A3, \u00A5, \u20A9 do replace with \uFFE0, \uFFE1, \uFFE5, \uFFE6 --- These are currency symbols in addition to $ which is included in the fisrt range All other code points relate to (Japanese) katakana and (Korean) hangul characters and some rarely used CJK characters for which there are no relevant equivalents in Latin scripts. People may find use for a similar macro for in particular the Japanese and Korean-related characters, but I do not have the knowledge to evaluate it. In short, the task would be to create two macros for points a-c above, one from fullwidth to halfwidth, the other from halfwidth to fullwidth. All the best. |
Beta Was this translation helpful? Give feedback.
-
since you already started with pseudo code, here is a macro which goes through every text line. |
Beta Was this translation helpful? Give feedback.
-
I assume, you want something like this:
|
Beta Was this translation helpful? Give feedback.
-
This is the result, and it works for me. Hope it conforms to txs norms. As it may be of use to others, I suggest that it be made available. Again, thanks CJK Full- to Halfwidth Transformation %SCRIPT CJK Half- to Fullwidth Transformation %SCRIPT |
Beta Was this translation helpful? Give feedback.
-
I wonder whether it's possible to make a macro script to change half-width Unicode characters into full-width (and the reverse). This affects the original lower ASCII characters (empty space, 0..9, a..z, A..Z and punctuation), which are all half-width when used in European languages, but which when part of Kanji/Hanzi text must be treated as full-width characters, see https://www.unicode.org/charts/PDF/UFF00.pdf (and https://www.unicode.org/charts/PDF/U3000.pdf), for in order to achieve an eye-pleasing result, all full-width characters including the empty space must be rendered with the CJKmainfont setting of the document. The problem is that when copying and pasting and/or typing in Chinese or Japanese text, the "lower ASCII" characters often default to half-width. Conversely, when full-width numerals and punctuation slip into normal half-width text, the results are equally awful. A macro (like the one to change lower to UPPER case) would be very convenient for cleaning up text. I can't get my head around the macro-scripting, so hope that somebody is able to help.
Beta Was this translation helpful? Give feedback.
All reactions