• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How can I remove/reset Japanese formatting?

Participant ,
Aug 02, 2022 Aug 02, 2022

Copy link to clipboard

Copied

I have two text frames, both in the SAME paragraph and character style, with no style overrides (according to InDesign). However, one of them has some weird Japanese formatting options applied to it, making it right-aligned, rotated, and slightly smaller:

 

2022-08-02_18-39-17_InDesign_test.indd_@_300%.png

I'm aware there's a Japanese version of InDesign, but I have no idea how Japanese formatting works, so it doesn't seem useful to me. Using it shouldn't be necessary, anyway: the desired style is in the same document. How can I make the "Japanese" text frame look like the "normal" text frame? 

TOPICS
Scripting , Type

Views

895

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Aug 06, 2022 Aug 06, 2022

I got that wrong, sorry. It should be this:

app.activeDocument.stories.everyItem().properties = {
  storyPreferences: {
    storyOrientation: StoryHorizontalOrVertical.HORIZONTAL
  }
};

It works only in the real CJK InDesign. 

Votes

Translate

Translate
Community Expert ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

Maybe the 'Japanese' frame has an object style applied, or the applied object style has some overrides. Did you check that?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

Oh, I totally forgot about that, nice catch. Unforunately, its object style was only applying the right-alignment. So it's still rotated and slightly smaller.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

If gdwd's document is suddenly exhibiting CJK behaviors, then something is going wrong, but the best solution that I can think of would be to write a script that returns text frame to horizontal orientation, but I've not yet been able to pull it off. The 

 

I spent maybe three hours last night trying to solve gdwd's question. In the InDesign object model, I found storyHorizontalOrVertical. I also found previous conversation about turning vertical text frames to horizontal text frames, but for the life of me I couldn't get a script to turn a vertical text frame to a horizontal one. I couldn't even get the JS console or the Object Model to admit that storyOrientation was even a storyPreference. So, I thought to myself, maybe some ACP who knows way more about JS scripting in ID than myself can explain this mystery?

 

I do know that you can affect text rotation with scripting fairly easily, if you turn on the Japanese Composer. So gdwd, if you select the vertical text and go to the Justification menu (CtrlAltShift J, on Windows), is the "Composer" dropdown saying "Adobe Japanese Composer"? 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

The composer was originally "Adobe Japanese Paragraph Composer," but it's been changed to a World Ready one as part of its new paragraph style. I'm working with .indds supplied by a Japanese company. Japanese composer is still enabled in my non-Japanese InDesign.

 

I'm not very experienced with Javascript, should the script for changing text orientation be:

app.documents.textFrame.parentStory.storyPreferences.storyOrientation=StoryHorizontalOrVertical.HORIZONTAL

 

If so, it looks like that doesn't work even when Japanese composer is on. Maybe it requires Japanese InDesign? That would be really weird.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

That is what I was wondering, if storyOrientation was in CJK InDesgin only; kinda hoping a little bit that Peter Kahrel, or one of the other local JS wizards, can tell us.  I've written scripts that used storyPreferences.storyDirection, for doing RTL stuff, and was a little put out that storyOrientation (and storyHorizontalOrVertical) won't work the exact same way.  I can go to the JS console in ExtendScript and paste in 

 

app.selection[0].parentStory.storyPreferences.storyDirection

 

and get back immediately

 

Result: LEFT_TO_RIGHT_DIRECTION

 

so why does

 

app.selection[0].parentStory.storyPreferences.storyOrientation

 

come back with

 

Error: Object does not support the property or method 'storyOrientation'

 

?

 

Because that's how I'd write the script that should fix your frame.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

// Maybe it requires Japanese InDesign?

Maybe, but it shouldn't be necessary. My (English) InDesign has the StoryHorizontalOrVertical enumeration, but not the storyOrientation property. Can't find it, anyway. This is strange, there are some posts that show that it exists, but these are by (the respected) milligram, who is Japanese, and uses the Japanese InDesign. All the Middle-East and CJK properties are preset in the scripting 'standard' InDesign DOM, so the absence of storyOrientation in these versions must be a bug..

@gdwd -- Could you post that document you showed in your screenshot? I'm intrigued.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

Sure, here you go. You can see in the top right of the first page is the desired style. On the third page there's an original horizontal Japanese orientation text frame (in case that helps with anything).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 04, 2022 Aug 04, 2022

Copy link to clipboard

Copied

Thanks for the file.  In the frame with the smaller type size, the type was scaled to 82%, so that was a local change, as Dirk suggested.

The orientation in the frames is set by the StoryOrientation property, which isn't exposed in the interface or in the scripting DOM, but it shows in the IDML. When you export the file to IDML and change all instances of

StoryOrientation="Vertical"

to

StoryOrientation="Horizontal"

the document will be fine, as you'll see when you reimport the file into InDesign.

To edit an IDML file, change its type to ZIP, unzip it, do the replacements in all the files, zip everything and change .zip to .idml. (You can also edit the idml directly in Oxygen, without un- and rezipping.)

But now that I write this I'm wondering how StoryOrientation can end up in the IDML if it's not in the scripting DOM. . .

 

Another possibility is to change your InDesign to Japanese, as described here:

https://ken-lunde.medium.com/adobe-indesign-tips-japanese-cjk-functionality-english-ui-redux-539528e...

This is not a reinstallation, it changes your ID's interface to the Japanese version but all text is in English. An English-localised Japanese InDesign, so to speak.

P.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 04, 2022 Aug 04, 2022

Copy link to clipboard

Copied

So does this mean a scripting solution doesn't exist, in either version of InDesign?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 04, 2022 Aug 04, 2022

Copy link to clipboard

Copied

I hacked together a very stupid script that changes text orientation of every selectable thing in a document to horitontal.

for (var j=0; j<app.activeDocument.pages.length; j++) {

	app.activeWindow.activePage=app.activeDocument.pages[j];
	app.select(app.activeWindow.activePage.allPageItems);

	for (var i=0; i<app.selection.length; i++) {
		app.activeDocument.selection[i].parentStory.storyPreferences.storyOrientation = StoryHorizontalOrVertical.HORIZONTAL;
	}
}

It probably fails if there are any selectable objects that aren't text frames. I know everyItem() exists and would probably be simpler, but I couldn't get it to work with parentStory.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 04, 2022 Aug 04, 2022

Copy link to clipboard

Copied

And yes, this script seems to ONLY work in the CJK version of InDesign, for some mysterious and unknowable reason.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 04, 2022 Aug 04, 2022

Copy link to clipboard

Copied

So does this mean a scripting solution doesn't exist, in either version of InDesign?

In the Japanese InDesign it's straightforward because storyOrientation exists. In the non-CJK InDesign you can script the procedure I outlined earlier (roundtrip via IDML), but that's not exactly straightforward.

 

Just for interest's sake, you can get your script to work (in the Japanese InDesign) using everyItem() as follows:

 

app.activeDocument.stories.everyItem().storyPreferences.storyOrientation = StoryHorizontalOrVertical.HORIZONTAL;

 

P.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 04, 2022 Aug 04, 2022

Copy link to clipboard

Copied

That script doesn't for me, in either version on InDesign. No error message, just nothing happens.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 06, 2022 Aug 06, 2022

Copy link to clipboard

Copied

LATEST

I got that wrong, sorry. It should be this:

app.activeDocument.stories.everyItem().properties = {
  storyPreferences: {
    storyOrientation: StoryHorizontalOrVertical.HORIZONTAL
  }
};

It works only in the real CJK InDesign. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

Could it be that the frame is just rotated by the rotate tool or the control strip's rotate by 90 degrees button? Some additional transform may explain the distortion.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Aug 05, 2022 Aug 05, 2022

Copy link to clipboard

Copied

@Peter Kahrel wrote:


But now that I write this I'm wondering how StoryOrientation can end up in the IDML if it's not in the scripting DOM. . .

 

ScriptInfo resources are used as source of the "Scripting DOM".

Each resource has snippets such as declaring an enum kHorizontalVerticalEnumScriptElement with its name (string), comment (string for OMV) and enum values, a property or a method argument etc. referring to it, and a piece of code that implements the property on some objects. The same property may get supported on other objects by other code, so a plug-in may create a new kind of page item, and implement original InDesign properties for that.

Properties can also get obsoleted.

These ScriptInfo resources are prefaced with a set of conditions - the script manager (ExtendScript, AppleScript, INX, IDML or Core shared by all), the product (ID, IC, ID Server) and the language feature set (Roman, Japanese, RightToLeft). 

For example the CS2 "story orientation" is obsoleted in story prefs, but CS3 added a "column direction" property to margin prefs, CS5 added "writing direction" to table cells.

Maybe you can still access story orientation in a versioned script?

Story direction is also a property considered by TOC style, so by creating a TOC into a frame you may be able to set the direction.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 05, 2022 Aug 05, 2022

Copy link to clipboard

Copied

Thanks for that info, Dirk. Going back through the OMV versions I can see that storyDirection was introduced in CS4. But I can't see storyOrientation in any version, going back to CS.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 05, 2022 Aug 05, 2022

Copy link to clipboard

Copied

Hi @gdwd ,

perhaps its easier to export, edit and place IDMS files from the text frames when in a non-CJK version of InDesign ? [*]

 

Found a rather "dirty" solution for my German InDesign version where I add a new text frame and duplicate the text over to the new frame. Before running the script, select the text frame:

/**
* @@@BUILDINFO@@@ AddNewTextFrame-DupTextToNewFrame-SELECTION.jsx !Version! Fri Aug 05 2022 17:47:08 GMT+0200
*/


( function()
{

app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;

app.doScript
(

	addNewTextFrameRemoveSelectedOne, 
	ScriptLanguage.JAVASCRIPT, 
	[],
	UndoModes.ENTIRE_SCRIPT, 
	"Add new text frame, move text over and remove selected text frame | SCRIPT"

);

function addNewTextFrameRemoveSelectedOne()
{
	// SELECTED TEXT FRAME:
	var textFrame = app.selection[0];
	textFrame.redefineScaling();

	// To find the right spread I am using this helper code.
	// Not needed if the original text frame is not positioned
	// in a nested structure like a group of objects or is anchored or is pasted inside a graphic frame:
	var dup = textFrame.duplicate();
	var spread = dup.parent;
	dup.remove();
	
	/*
		For not nested contents we can get the spread like that:
		var spread = textFrame.parent;
	*/

	var newFrame = spread.textFrames.add();
	newFrame.paths[0].entirePath = textFrame.paths[0].entirePath;

	textFrame.parentStory.duplicate
	( 
		LocationOptions.AT_BEGINNING , 
		newFrame.parentStory 
	);

	// OPTIONAL:
	textFrame.remove();

};

}() )

 

Note: You can undo all the script's action in one go.

It will also redefine scaling so that the frame is not showing a scaling percentage anymore.

 

[*] That should also be scriptable, but requires more effort.

 

Regards,
Uwe Laubender
( Adobe Community Professional )

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines