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:
Reply To:
Date:
Sat, 22 Apr 2017 17:58:36 +0900
Content-Type:
text/plain
Parts/Attachments:
text/plain (37 lines)
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


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.


Kino

ATOM RSS1 RSS2