๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #15843

Re: Entering Unicode Characters in InDesign CS

#15843
From: Olav_Kvern
Date: Fri, 07 Nov 2003 19:15
31 lines
2355 bytes
Gang--

Okay, I'll try again with Shane's suggested tag (thanks, Shane!):



//JavaScriptUnicodeExample.js 
//The old way--using Unicode strings (this does not work in InDesign CS JavaScript): 
//var myString = "<5B87><5B99><306E><30B9><30C6><30EB><30F4><30A3><30A2>"; 
//The new way--using Unicode characters (make sure you save the script as Unicode text): 
var myString = ๅฎ‡ๅฎ™ใฎใ‚นใƒ†ใƒซใƒดใ‚ฃใ‚ข\rstellvia of the stars"; 
//...won't work in the forum unless you include the tag: 
//<meta http-equiv="content-type" content="text/html; charset=utf-8"> 
//at the start of the message. 
//You can also use the JavaScript Unicode approach "\u" 
//var myString = "\u5B87\u5B99\u306E\u30B9\u30C6\u30EB\u30F4\u30A3\u30A2\rstellvia of the stars"; 
var myFont = app.fonts.item("Kozuka Gothic Pro\tM"); 
var myDocument = app.documents.add(); 
var myX1 = myDocument.pages.item(0).marginPreferences.left; 
var myY1 = myDocument.pages.item(0).marginPreferences.top; 
var myX2 = myDocument.documentPreferences.pageWidth - myDocument.pages.item(0).marginPreferences.right; 
var myY2 = myDocument.documentPreferences.pageHeight - myDocument.pages.item(0).marginPreferences.bottom; 
var myTextFrame = myDocument.pages.item(0).textFrames.add(undefined, undefined, undefined, {contents:myString, geometricBounds:[myY1, myX1, myY2, myX2]}) 
myTextFrame.parentStory.properties = {appliedFont:myFont, pointSize:48, justification:Justification.centerAlign, leading:72};

That seems to work (at least when the page encoding is set to Unicode-8 *when I paste the text*)!

Thanks,

Ole
Technical Details
Message-ID: <2cce3bc9.6@webx.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!news.algonet.se!algonet!news.tele.dk!news.tele.dk!small.news.tele.dk!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webx
References: <2cce3bc9.-1@webx.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,UTF8
X-Google-Thread: f939a,477cd82366b5505d
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-11-07 11:38:18 PST
From: Olav_Kvern@adobeforums.com
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!news.algonet.se!algonet!news.tele.dk!news.tele.dk!small.news.tele.dk!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webx
Newsgroups: adobe.scripting.indesign
Subject: Re: Entering Unicode Characters in InDesign CS
Message-ID: <2cce3bc9.6@webx.la2eafNXanI>
Date: Fri, 7 Nov 2003 11:15:00 -0800
References: <2cce3bc9.-1@webx.la2eafNXanI>
Lines: 39
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit