Part of Nobumi Iyanaga's website. n-iyanag@ppp.bekkoame.ne.jp. 10/7/00.

logo picture

Mac RTF to Win RTF of Japanese text

First appeared as a message in Japanese in the electronic discussion group "Nisus/QUED倶楽部", in the Japanese commercial BBS NiftyServe (FJAMEA/09/00118), on June 30 1999. I reproduce the original Japanese text; the English text which follows it has been written for our Nisus Macro Tips Center by the author, Mr. Masahiko IWAMA, who is one of the active members of this discussion group.


Claris の RTF フィルタで変換した RTF ファイルを WinWord/WordPad 
で開くためのマクロを作ってみました.Mac と Win で対応するフォン
トがある場合 (例えば Symbol とか) はそれを尊重し,ない場合には 
Helvetica を Arial に変更するなど似た書体を使うにしました.また,
一般的なフォントのみを変換するようにしています.

指定外の日本語フォントはすべて MS P 明朝に変換されます (そのよう にマクロを組んでいます).指定外の英文フォントについては何も変換 しませんが,私の WinWord/WordPad で試した限りでは MS 明朝になっ ていました.

通信のために改行が入ってしまうと思うので,マクロの実行に支障のあ る " " で囲まれた部分の中の改行を除去してください.

---------------------------------

IWAMA Masahiko miwama@imasy.or.jp MAF00103@nifty.ne.jp

Mac RTF to Win RTF

This macro converts a Mac RTF file containing Japanese 2-byte characters to a Windows RTF file. When a Mac document file is saved as a RTF file using Claris XTND filter, the font information of Mac is preserved without interpretation. Since Win Word does not understand the information of the Japanese Mac fonts, all the Japanese text in the file is recognized as a Roman text and displayed with a Roman font when the file is opened by Win Word. What is worse is that Win Word does not respond to font change command over such a text, so there is noway to read the text. This macro aims to remedy this problem.

The Mac RTF file must be created using Claris XTND filter. MacLinkPlus of any version does not handle 2-byte characters by nature.

First, save the file using Save As... command designating RTF format in NisusWriter or in any word processor that supports Claris XTND system. Open the file from within NisusWriter as a Nisus file or text file, then run the macro. Be sure not to open it as a RTF file. After running the macro, rename the file as "xxx.rtf" and save it as a Nisus file. The file may be ported to Windows and opened by Win Word or WordPad. The Mac fonts are replaced with the closest Windows fonts (all text written in fonts which are not defined in this macro will be displayed in MS P Mincho font). That is, the Japanese text is displayed with Japanese fonts.

The macro is written by Masahiko Iwama under a great assistance of Mr. Nobumi Iyanaga.

// Start of Macro // Move the cursor to the top of document. SetSelect (0, 0)

// Replace Mac font definitions with Windows'. Find/Replace "\{\\f:d+:.:*\r" "\{\\f0\\fnil\sMS\sSans\sSerif\;\}\{\\f1\\fnil\\fcharset2\sSymbol\;\}\{\\f5\\fswiss\\fprq2\sArial\;\ }{\f7\fmodern\fprq1sCouriersNew;}{\f8\froman\fprq2sBookmansOldsStyle;}{\f10\from an\fprq2sCentury;}{\f14\fmodern\fprq2\fcharset128sHG\'8a\'db\'ba\'de\'bc\'af\'b8M- PRO;}{\f18\fmodern\fprq2\fcharset128s\'82\'6c\'82\'72\'82\'6f\'83\'53\'83\'56\'83 \'62\'83\'4e;}{\f19\fswiss\fprq2sImpact;}{\f20\fmodern\fprq1\fcharset128s\'82\'6 c\'82\'72s\'83\'53\'83\'56\'83\'62\'83\'4e;}{\f21\froman\fprq1\fcharset128s\'82 '6c\'82\'72s\'96\'be\'92\'a9;}{\f22\froman\fprq2\fcharset2sMTsExtra;}{\f23\fro man\fprq2\fcharset128s\'82\'6c\'82\'72s\'82\'6f\'96\'be\'92\'a9;}{\f24\froman\fp rq2sTimessNewsRoman;}{\f25\fswiss\fprq2sVerdana;}}r" "g-StA" //All this, from "Find/Replace" is in one line!

// Move the cursor to the top of document. SetSelect (0, 0) // Temporarily cut the font definitions. Find "\{\\rtf:.:*\r" "g-StA" Cut

// Change the Mac font IDs to those of Windows counterparts. // Change Times to Times New Roman. Replace All "\f20\" "f24" "-gt-SA" // Change Geneva to Verdana. Replace All "\f3\" "f25" "-gt-SA" // Change Symbol to Symbol. Replace All "\f23\" "f1" "-gt-SA" // Change Helvetica to Arial. Replace All "\f21\" "f5" "-gt-SA" // Change Courier to Courier New. Replace All "\f22\" "f7" "-gt-SA" // Change Bookman to Bookman Old Style. Replace All "\f14\" "f8" "-gt-SA" // Change NewYork/Palatino to Century. Replace All "\(\\f2\\|\\f16\\\)" "\\f10\\" "gt-SA" // Change Maru Gothic-M to HG Maru Gothic M-PRO. Replace All "\f16703\" "f14" "-gt-SA" // Change Heisei Kaku Gothic/Chu Gothic/Osaka to MSP Gothic. Replace All "\(\\f16701\\|\\f16640\\|\\f16384\\\)" "\\f18\\" "gt-SA" // Change Chicago/Charcoal to Impact. Replace All "\(\\f16383\\|\\f2002\\\)" "\\f19\\" "gt-SA" // Change Tohaba Gothic/Osaka-Tohaba to MS Gothic. Replace All "\(\\f16433\\|\\f16436\\\)" "\\f20\\" "gt-SA" // Change MT Extra to MT Extra. Replace All "\f2515\" "f22" "-gt-SA" // Change Tohaba Mincho to MS Mincho. Replace All "\f16435\" "f21" "-gt-SA" // Change all the Japanese fonts other than the above to MS P Mincho. Replace All "\(\\f16[4567][0-9][0-9]\\|\\f1639[0-9]\\|\\f1638[4-9]\\|\\f168[0-8][0-9]\\|\\f1689[0- 5]\)" "\f23\" "gt-SA" //All this, from "Replace All" is in one line!

// Move the cursor to the top of document. SetSelect (0, 0) // Paste the font definitions previously cut. Paste

// Set the line space. Replace All "\\sl\-" "\\sl" "gt-SA"

// End of Macro


Now, here is this macro, Mac RTF to Win RTF (6K to download), that you can download.


Return to
Nisus Macros Tips Center | to Nisus Main Page


Return to NI HomePage


Mail to Nobumi Iyanaga


frontierlogo picture

This page was last built with Frontier on a Macintosh on Sat, Oct 7, 2000 at 19:06:42. Thanks for checking it out! Nobumi Iyanaga