NISUS Archives

April 2017

NISUS@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Nobumi Iyanaga <[log in to unmask]>
Reply To:
Date:
Sun, 23 Apr 2017 05:25:40 +0900
Content-Type:
text/plain
Parts/Attachments:
text/plain (53 lines)
Hello Yusuke,

Thank you very much for your two replies.

> On Apr 22, 2017, at 5:58 PM, Kino <[log in to unmask]> wrote:
> 
> I have overlooked some code. The following works for me.
> 
> $doc = Document.active
> if $doc == undefined  # if there is no open document...
> 	exit
> end
> # $text = $doc.text
> $sels = $doc.textSelections
> 
> $map = Hash.new
> $map{'悪'} = '惡'
> $map{'芦'} = '蘆'
> $map{'圧'} = '壓'
> # ...
> 
> if $sels.firstValue.length  # if there is a visible selection (not just a caret)...
> 	foreach $sel in $sels
> #		$text.transliterateInRange($sel.range, $map)
> 		$sel.text.transliterateInRange($sel.range, $map)
> 	end
> else
> 	$newDoc = $doc.copy
> #	$text = $newDoc.text
> #	$sels = $doc.text.findAll '\p{Han}+', 'E', '-am'
> 	$sels = $newDoc.text.findAll '\p{Han}+', 'E'
> 	foreach $sel in $sels
> #		$text.transliterateInRange($sel.range, $map)
> 		$sel.text.transliterateInRange($sel.range, $map)
> 	end
> end

Thank you so much for these corrections. I am sure that will be very helpful to my work!

> 
> 
> However, as of NWP 2.1.7 running on OS X 10.11.6, transliterateInRange seems to be buggy. For text in footnotes, it changes Japanese fonts (Hiragino Mincho ProN, YuMincho) to Andale Mono so that the transliterated strings are displayed using the fall back font (Hiragino KakuGothic?). What is strange is that Andale Mono is not used in the test file nor in the macro file. I will report this bug to Nisus soft.

Yes, in fact, with your another reply, I tried to run the macro -- and had similar problems in the footnotes of the document on which I am working. That not only changed the fonts of Japanese text, but also changed italic to non-italic, or red color to black color, in a very random way. This is a major bug... (I am running OS 10.10.5).

But anyway, thank you very much for your kind help!

Best regard,

Nobumi Iyanaga
Tokyo,
Japan

ATOM RSS1 RSS2