Japanese Feature Additions in InDesign CS

Transcription

Japanese Feature Additions in InDesign CS
Japanese Feature
Additions in InDesign CS
Technical Note #10088
Version InDesign CS
26 July 2004
ADOBE SYSTEMS INCORPORATED
Corporate Headquarters
345 Park Avenue
San Jose, CA 95110-2704
(408) 536-6000
Copyright 2004 Adobe Systems Incorporated. All rights reserved.
The information in this document is furnished for informational use only, is subject to change without notice, and should not be construed as a
commitment by Adobe Systems Incorporated. Adobe Systems Incorporated assumes no responsibility or liability for any errors or inaccuracies that
may appear in this document. The software described in this document is furnished under license and may only be used or copied in accordance with
the terms of such license.
Adobe and Adobe InDesign are trademarks of Adobe Systems Incorporated that may be registered in certain jurisdictions. Macintosh and Apple are
registered trademarks, and Mac OS is a trademark of Apple Computer, Inc. Microsoft, Windows, Windows NT and Windows XP are registered
trademarks of Microsoft Corporation. All other products or name brands are trademarks of their respective holders.
Rev #
Date
Author
Comments
0.1
4 Feb 2004
Ken Sadahiro
Initial Draft.
0.2
31 Mar 2004
Ken Sadahiro
Incorporated review comments from Heath
Lynn, Nat McCully, Margie Vogel, and Heath
Horton. Updated graphics. Ready for public
distribution.
0.3
5 May 2004
Ken Sadahiro
Fixed figure headings and a few minor
grammatical errors.
0.4
26 July 2004
Ken Sadahiro
Made corrections based on review by the
translator for the Japanese version of this
document.
Contents
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Terminology and Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Feature Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
The need for a new way of distinguishing features, not locales . . . . . . . . . . . . . . . . . . . . . 8
How are feature sets used in the application plug-ins? . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Working with Feature Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Japanese Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Introduction to the Japanese Art of Kumihan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Further References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Japanese Layout: Layout Grids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Description of workflow and various Layout Grid settings . . . . . . . . . . . . . . . . . . . . . . . 14
Class Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Navigation Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Commands and Notification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Working with Layout Grids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Japanese Layout: Frame Grids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Description of workflow and various Frame Grid settings . . . . . . . . . . . . . . . . . . . . . . . 24
Interactions between Frame Grid settings and the Text Model . . . . . . . . . . . . . . . . . . . . 26
Class Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Navigation Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Commands and Notification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Working with Frame Grids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Japanese Layout: Measurement Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Description of Special Japanese Measurement Units . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Conversion Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Class Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Where these units are used. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Special provisions for documents saved with these units. . . . . . . . . . . . . . . . . . . . . . . . 39
Working with Japanese Measurement Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Japanese Typography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Introduction to the Japanese Art of Mojikumi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Overview of Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Terminology and Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Overview of the Japanese Typography Chapters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
iii
Contents
Further References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Japanese Typography: Japanese Text Composers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Background information and descriptions of usage scenarios . . . . . . . . . . . . . . . . . . . . 44
Class Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Navigation Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Commands and Notification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Working with Japanese Text Composers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Idiosyncrasies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
References and Samples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Japanese Typography: General Mojikumi features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Background information and descriptions of usage scenarios. . . . . . . . . . . . . . . . . . . . . 49
Class Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Navigation Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Commands and Notification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Working with Mojikumi Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
References and Samples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Japanese Typography: Japanese-Specific Text Attributes and Adornments . . . . . . . . . . . . . . . 58
Background information and descriptions of usage scenarios . . . . . . . . . . . . . . . . . . . . 58
Class Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Navigation Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Commands and Notification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Working with Text Attributes and Adornments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
References and Samples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Japanese Typography: Composite Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Background information and descriptions of usage scenarios . . . . . . . . . . . . . . . . . . . . 69
Class Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Navigation Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Commands and Notification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Working with Composite Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
References and Samples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
Platform Specific Character Encoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
Background information and descriptions of usage scenarios . . . . . . . . . . . . . . . . . . . . 80
Working with Japanese character encoding standards . . . . . . . . . . . . . . . . . . . . . . . . . 83
References and Samples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Input Method Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Background information and descriptions of usage scenarios. . . . . . . . . . . . . . . . . . . . . 86
Class Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Navigation Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Commands and Notification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Working with IMEFeatures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
iv
5 May 2004
Japanese Feature Additions in InDesign CS
Contents
References and Samples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
Japanese Feature Additions in InDesign CS
5 May 2004
v
Contents
vi
5 May 2004
Japanese Feature Additions in InDesign CS
1
Japanese Feature Additions for InDesign
Overview
This document provides an overview of the Japanese specific-features that have been
incorporated into the InDesign architecture and features, discusses techniques for exercising
these features using the InDesign CS application programming interface (API), and provides
various references of the API as well as sample code included in the InDesign CS Software
Development Kit (SDK).
Terminology and Definitions
Some of the sections in this document contain a specific Terminology and Definitions section.
Please refer to the specific sections for details.
Introduction
The core architecture of InDesign allows for both Roman and Japanese layout and text objects
to coexist on a single document. That means you can take a document with Japanese-specific
layout and text settings that were composed using the Japanese version of InDesign (InDesign
CS-J herein), and open it with the Roman versions of InDesign (InDesign CS herein).
This document introduces the architectural elements that allow InDesign to have a different
user experience between the Japanese version and other versions. This document also
introduces features that are added onto the existing layout and text subsystems that make up
the Japanese feature set, and provides details on how to use the API to manipulate these
features.
This document is of interest to you if:
•
You want to ensure that you haven’t overlooked any aspects of layout and text features, so
that your plug-ins will work without unforeseen problems on the InDesign CS-J.
•
You want to add support for specific Japanese features to your plug-ins.
The questions this document answers are:
1.
What are feature sets, and how do you utilize them?
2.
What are the unique Japanese layout features in InDesign CS-J, and how do you utilize
them?
3.
What are the unique Japanese typography features in InDesign CS-J, and how do you
utilize them?
Japanese Feature Additions for InDesign
7
Japanese Feature Additions for InDesign
Feature Sets
4.
What are some of the aspects of Japanese character encodings and fonts one should know
about?
Feature Sets
The need for a new way of distinguishing features, not locales
InDesign has the capability of displaying different sets of strings and user interface (UI)
elements based on a UI locale setting. However, using the UI locale to distinguish features may
expose some limitations. For instance, what if the features that were unique for the Japanese
version needed to be provided with a completely different UI than the Roman versions?
The concept of a “feature set” was introduced to allow a distinction of features that are
independent from the concept of UI locales. While locales distinguish which language the
strings in the UI are displayed in, feature sets determine which strings and menus and palettes
appear in the UI.
How are feature sets used in the application plug-ins?
In the InDesign application, feature sets are used primarily to determine the types of UIs to
display for specific features. By distinguishing the UI, InDesign provides a user experience that
is unique to a feature set. If the InDesign application distinguished model components by
feature sets, documents created in InDesign CS-J will not be usable under Roman versions of
InDesign CS.
The following plug-ins are loaded only in the Japanese Feature Set. (NOTE: They are installed
only in InDesign CS-J.) At application start up time, the plug-ins with these PluginIDs are
loaded only if the feature set flag is set to kInDesignJapaneseFS:
8
•
kCJKLayoutPluginID (Required/CJKLayout.rpln)
•
kCJKGridPrefsDialogPluginID (PlugIns/CJK/CJKGridPrefsDialog.apln)
•
kCompFontDlgPluginID (Plug-Ins/CJK/CompFontDlg.apln)
•
kFrameGridPluginID (Plug-Ins/CJK/Frame Grid Dialog.apln)
•
kIMEPrefsDlgPluginID (Plug-ins/CJK/IMEPrefsDlg.apln)
•
kKentenDlgPluginID (Plug-Ins/CJK/KentenDlg.apln)
•
kKinsokuDlgPluginID (Plug-Ins/CJK/KinsokuDlg.apln)
•
kMojikumiDlgPluginID (Plug-Ins/CJK/MojikumiDlg.apln)
•
kNamedGridsPanelPluginID (Plug-Ins/CJK/NamedGridsPanel.apln)
•
kPageGridPluginID (Plug-Ins/CJK/Layout Grid Dialog.apln)
•
kRubyDlgPluginID (Plug-Ins/CJK/RubyDlg.apln)
Japanese Feature Additions for InDesign
Feature Sets
•
kShataiDlgPluginID (Plug-Ins/CJK/ShataiDlg.apln)
•
kTateChuYokoDlgPluginID (Plug-Ins/CJK/TateChuYokoDlg.pln)
In addition, the plug-in with the ID kIMEPluginID (Plug-ins/CJK/IME.apln) is
installed only with InDesign CS-J, even though it can be loaded under all feature sets.
Working with Feature Sets
How to load your plug-in only under a certain feature set
By specifying a FeatureSet option in your plug-ins PluginVersionresource (*.fr file),
you can specify the feature sets in which your plug-in should be loaded.
resource PluginVersion (1)
{
kTargetVersion,
kMyPluginID,
kMajorVersionNumber,
kMinorVersionNumber,
kMajorVersionNumber,
kMinorVersionNumber,
kCurrentMajorFormatNumber,
kMyMinorFormatNumber,
{ kInDesignProduct, kInCopyProduct },
{ <Specify FeatureSet here> },
SDK_DEF_MAKE_VERSIONSTRING
(3,0,0, kBuildNumber)
}
The valid values for the Feature Set option are defined in
{SDK}/source/public/includes/FeatureSets.h.
If you specify:
•
kInDesignJapaneseFS: The plug-in is loaded only for InDesign CS-J.
•
kInDesignRomanFS: The plug-in is loaded only for the InDesign CS.
•
kWildFS: The plug-in is loaded regardless of the feature set.
In addition to allowing for specific plug-ins to be loaded only under certain feature sets, you
can also specify the PluginDependency resource to depend on feature sets:
resource PluginDependency (1)
{
<Specify FeatureSet here>,
{
// MyUI is only required in a specific feature set.
kMyUIPluginID,
Japanese Feature Additions for InDesign
9
Japanese Feature Additions for InDesign
Feature Sets
kMyUIPluginName,
kMajorVersionNumber,
kMinorVersionNumber,
}
};
Other ODFRez resources where you can specify a feature set
Any resource where you specify locale specific entries in a LocaleIndex can have a feature
set specified. For instance, consider this string table:
resource LocaleIndex (kSDKDefStringsResourceID)
{
kStringTableRsrcType,
{
kWildFS, k_enUS,
kSDKDefStringsResourceID + index_enUS
kWildFS, k_enGB,
kSDKDefStringsResourceID + index_enUS
// ... other feature sets and locales...
kInDesignJapaneseFS, k_jaJP,
kSDKDefStringsResourceID + index_jaJP
}
};
This string table indicates that the Japanese string table will only be loaded under the Japanese
feature set (kInDesignJapaneseFS) AND Japanese UI locale (k_jaJP). Other string
tables will be loaded in their respective UI locales, regardless of feature set.
NOTE: The above string table indicates that there are no string table entries for the
kInDesignRomanFS and k_jaJP combination, which is not a supported configuration.
How to load specific bosses only under a certain feature set
You won’t be able to specify if a boss class should be instantiated or not under a certain feature
set, however, you can organize such boss classes into separate plug-ins, and distinguish by the
feature set setting in the PluginVersion resource.
In your plug-in code, be aware that certain boss classes (especially UI-related) may be feature
set dependent and may not be instantiated when you think.
How to determine the current feature set at run-time
Feature sets can be obtained via the PMLocaleId class from the static LocaleSetting
class.
const PMLocaleId locale = LocaleSetting::GetLocale();
int16 featureSetID = locale.GetFeatureSetId();
Refer to FeatureSets.h for the valid values.
10
Japanese Feature Additions for InDesign
Feature Sets
How to change the feature set
Changing the feature set is not supported at run-time, since a change in the feature set requires
that the InDesign object model be completely refreshed. (InDesign does not support the
dynamic refreshing of the object model.) To change the feature set, you must either process a
command (kChangeLocaleCmdBoss) and restart InDesign immediately, or change the
application settings outside the context of an application session.
•
Windows: Using the Registry Editor (regedit.exe), change the registry key
HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\InDesign\<Version>\Featur
e Set Locale Setting (where <Version>= 3.0) to either Hex 00000100
(kInDesignRomanFS) or Hex 00000101 (kInDesignJapaneseFS).
•
Macintosh: Using a resource editor such as ResEdit or Resourcerer, open the “InDesign
CS” or “InDesign CS _J“ application and change the ‘FEAT’ resource value to either Hex
00000100 (kInDesignRomanFS) or Hex 00000101 (kInDesignJapaneseFS).
•
NOTE: The CJK plug-ins are not installed on a Roman feature set installation. So if you
start with the Roman feature set as a base and switch the feature set, you aren’t operating
with a complete set of plug-ins that make up the “InDesign-CS-J” application. We suggest
changing the feature set this only as an internal testing procedure, and only if you have
installed the Japanese feature set of the application to start with. Do not use this as a
feature for a production plug-in.
Japanese Feature Additions for InDesign
11
Japanese Feature Additions for InDesign
Japanese Layout
Japanese Layout
Introduction to the Japanese Art of Kumihan
FIGURE 1.1
An InDesign CS-J document with Layout Grids and Frame Grids
Japanese publications are generally laid out in a manner that is different from Roman-language
publications. The differences mostly stem from the differences in the character set and type
setting rules. Consider the differences in how Japanese and Roman layouts are determined:
12
1.
In a Roman layout workflow, the page begins blank and margins are set (which
determines the content area from the outside-in). In a Japanese layout workflow,
character grids are used to define boxes where text will go, which determines the outside
margins in terms of the text content, in square character units. (InDesign CS-J offers both
the Roman workflow and the Japanese workflow when creating a new document.)
2.
The majority of the characters in the Japanese language are about the same size and shape
(described as “heikin-jizura”, or the size of an Ideographic Character Face (ICF) box,
which is typically a little smaller than an em-box), therefore, given a specific layout area
and the character size to be used, it is possible to specify the number of lines and
characters per line, which determine the total number of characters that should be
allocated to a page or column. Roman characters have variable widths, and the
hyphenation and justification (H&J) rules determine how the text flows in a given
Japanese Feature Additions for InDesign
Japanese Layout
amount of space, so it is simpler to specify the dimensions of the text areas in Roman
publications.
3.
Since Japanese characters are generally square, a grid can be used to guide the characters
onto the page layout. These layout-guiding grids are aligned against a specific reference
on a page, such as “Ten/Shoukuchi” (head/edge), “Chi/Nodo” (tail/gutter), or “TenchiChuou” (centered between head/tail). Roman page layout is generally determined
primarily by the margin sizes.
4.
Since layout-guiding grids are placed at a specific distance from a reference point on
Japanese page layouts, some of the margin widths are determined as a by-product of the
grid size and these reference distances. In Roman page layouts, the margin sizes generally
constrain the size of the text areas on a page.
5.
The sizes of characters and spacing in layout-guiding grids were historically determined
by the measurement units used by the early typesetting machines.
These differences require different parameters when setting up guiding components on a page
layout, which were abstracted into the following layout features that are unique in InDesign
CS-J:
•
Layout grids: The layout-guiding grids that are specified per page. Layout grids have
snapping points to allow placement of objects on the layout in terms of character units.
•
Frame grids: Text frames with grids that aid text placement. Frame grids affect text line
placement in the frame, much like baseline grids do.
•
Measurement Units: Q, Ha and American Points (or AP, as defined by the JIS Z 83051962 (1995 confirmed)).
These features become available in the InDesign UI only when the feature set is set to
kInDesignJapaneseFS, however, the model data is available for all UI locales and feature
sets.
These features are described in detail in the following sections.
Further References
The following chapters in the Programming Guide provide the necessary background
information necessary to fully understand the remaining sections on Japanese Features:
•
Document Structure
•
Commands
•
Persistence
•
Service Providers (for measurement units)
•
Page Items
•
Page Items Drawing
•
Page Items Adornments
•
Text Layout
Japanese Feature Additions for InDesign
13
Japanese Feature Additions for InDesign
Japanese Layout: Layout Grids
Japanese Layout: Layout Grids
Description of workflow and various Layout Grid settings
You can create documents with layout grids in InDesign CS-J. Layout grids provide a page
layout foundation based on the characteristics of the text that are to be laid out on a page.
Therefore, you can consider layout grid settings to be a property of a page.
Layout grid setting defaults and preferences are stored in both the document and global
workspaces. The default data in the workspaces get copied over during key events. For instance,
when you create a new document, the defaults in the global workspace get applied to the
document workspace. And when you create a new page, the layout grid defaults in the
document layout grids get applied to the page.
You can establish layout grid settings when:
•
You are creating a new document and select the Layout Grid option (Japanese feature set
only), you can set up the layout grid used for the default master page.
•
You select the Layout >> Layout Grid Settings...; menu item while a specific page (or
master page) has been selected.
This indicates that layout grid settings are properties of a page (kPageBoss).
The Layout Grid Settings dialog looks like this:
FIGURE 1.2
Layout Grid Settings Dialog (with references to model interfaces)
The top frame of this dialog is where the user specifies the text characteristics for the layout
grid, including default story direction (vertical or horizontal), font family and style, size,
vertical and horizontal scales, character spacing, and line spacing.
14
Japanese Feature Additions for InDesign
Japanese Layout: Layout Grids
The middle frame is where the user specifies grid characteristics, including the number of
characters per line, number of lines, number of columns, and the column spacing.
The bottom frame is where the user specifies layout grid starting point and margins. Note that
not all margins are to be specified by the user. In the InDesign UI, some margins are
automatically determined by the grid characteristics and the grid starting point (see
{SDK}/source/public/interfaces/cjk/ICJKLayoutGridData.h for the
enum GridStartingPoint), which are described here.
TABLE 1.1 Grid Starting Points
Grid Starting Point
Illustration
Description
Top Outside ( 天 / 小口 )
Layout grid positions based on top and outside
margins
Top Inside ( 天 / ノド )
Layout grid positions based on top and inside
margins
Bottom Outside ( 地 / 小口 )
Layout grid positions based on bottom and outside
margins
Bottom Inside ( 地 / ノド )
Layout grid positions based on bottom and inside
margins
Centered Vertically ( 天地中央 )
Layout grid positions centered vertically on page –
user specifies outside margin only, inside margin set
to be the same
Centered Horizontally ( 小口 / ノ
ド中央 )
Layout grid positions centered horizontally on page user specifies top margins only, bottom margin set to
be the same
Japanese Feature Additions for InDesign
15
Japanese Feature Additions for InDesign
Japanese Layout: Layout Grids
Grid Starting Point
Illustration
Centered ( 天地小口 / ノド中央 )
Description
Layout grid positions centered horizontally and
vertically on page - user specifies no margins
This diagram also shows the various model interfaces that correspond to the data set by the UI
widgets. The user-specified column and margin related settings, along with ICJKGridData and
direction settings in the top frame and the grid starting point setting, collectively complete the
margin and column settings. In the user interface, you only set a portion of the margin values,
and based on other values in this dialog, the other margin values are automatically calculated.
The result is a layout grid sized to the user’s specifications. The resulting size of the layout grid
bounding box is displayed at the very bottom of the dialog (height x width, in mm).
Class Diagram
Here are the boss classes and interfaces that are related to layout grids.
kDocWorkspaceBoss and kWorkspaceBoss
kDocWorkspaceBoss and kWorkspaceBoss aggregate interfaces that store the default layout
grid settings. kWorkspaceBoss stores the application defaults. When a new document is
created, that document’s kDocWorkspaceBoss inherits the default layout grid settings from
kWorkspaceBoss. If a user modifies the default layout grid settings on that document, only the
layout grid settings in kDocWorkspaceBoss are modified.
16
•
ICJKLayoutGridDefaults: Stores the default settings for layout grids, such as text size,
font, and aki data.
•
ICJKGridPrefs: Stores the document-wide character grid preferences, such as the shape of
each character cell, a flag that indicates if all layout grids should be shown, etc.
Japanese Feature Additions for InDesign
Japanese Layout: Layout Grids
•
ICJKGridPainter: Stores the Grid Painter boss class ID for the workspace. You can set the
grid painter boss class ID by processing kSetCJKGridPainterCmdBoss. The boss class
specified must aggregate an implementation of the IDrawCJKGrid interface. (The
application-provided implementation of IDrawCJKGrid is in
kDefaultCJKGridDrawBoss.)
kDocBoss
kDocBoss aggregates a few tracking related flags.
•
ICJKGridData (IID_ITRACKINGCJKGRIDDATA): Stores the tracking data based on the
CJK Grid. This data is used if the IBoolData (IID_ITRACKWITHCJKGRID) is set to
kTrue.
•
IBoolData (IID_ITRACKWITHCJKGRID): Enables and disables the CJK grid based
tracking.
•
IBoolData (IID_ITRACKWITHVERTICALGRID): Stores the grid direction for tracking.
kPageBoss
kPageBoss stores page-specific layout grid settings and a reference to the implementation
responsible for drawing the layout grid. A brand new document has one master page (“A”), and
one regular page which is based on the master page. The layout grid on the master page is
inherited from the layout grid defaults in kDocWorkspaceBoss, unless a user modifies the
settings. Also, a user can modify the layout grid settings on a specific page, overriding the
settings from the master page.
•
ICJKGridData: Stores the text-related grid settings.
•
ICJKLayoutGridData : Stores the grid starting point, and whether the page uses the grid
data from its master page (if yes, the ICJKGridData on this boss should be ignored).
Japanese Feature Additions for InDesign
17
Japanese Feature Additions for InDesign
Japanese Layout: Layout Grids
•
ICJKGridPainter: Stores the Grid Painter boss class ID for the page. You can set the grid
painter boss class ID by processing kSetCJKGridPainterCmdBoss. The boss class specified
must aggregate an implementation of the IDrawCJKGrid interface. (The applicationprovided implementation of IDrawCJKGrid is in kDefaultCJKGridDrawBoss.)
•
ICJKGridManager: Manages various aspects of the layout grid interaction and provides
calculated results of grid settings.
kDefaultCJKGridDrawBoss
kDefaultCJKGridDrawBoss is the application-provided grid drawing implementation. It is
shared by both the layout and frame grids.
•
IDrawCJKGrid: Contains the code to draw grids. (You can provide your custom grid
drawing code by specifying a boss with a custom implementaion of this interface. See
ICJKGridPainter above and kSetCJKGridPainterCmdBoss for details.)
kUtilsBoss
kUtilsBoss aggregates a utility interface for grid-related operations.
•
ICJKGridUtils: Provides a few useful bridge methods for layout grids.
Selection Related Bosses and Suite Interfaces
In addition to the model-related bosses listed above, you can manipulate grid-related settings
on the current selection context by using the ICJKGridSuite interface. Its CSBs are aggregated
in the following bosses:
•
kApplicationDefaultSuiteBoss: For setting the default layout grid settings in the
application default workspace, kWorkspaceBoss.
•
kDocumentDefaultSuiteBoss: For setting the default layout grid settings in the document
workspace, kDocWorkspaceBoss.
For more details on using suite interfaces and the ISelectionUtils utility interface, refer to the
InDesign CS SDK Technote titled “Selection”.
18
Japanese Feature Additions for InDesign
Japanese Layout: Layout Grids
Navigation Diagram
This diagram shows how to navigate from one layout grid related boss to another.
FIGURE 1.3
Navigation Diagram for the Layout Grid Model
Document
ICJKGridData (IID_ITRACKINGCJKGRIDDATA)
IBoolData (IID_ITRACKWITHVERTICALGRID)
IBoolData (IID_ITRACKWITHCJKGRID)
<<boss class>>
kDocBoss
IDocument
IDocument::GetDocWorkSpace
IPageList
1
ICJKLayoutGridDefaults
ICJKGridPrefs
ICJKGridPainter
<<boss class>>
kDocWorkspaceBoss
ICJKGridPainter::QueryDrawCJKGrid
1
IDrawCJKGrid
ICJKGridManager
1
ICJKGridUtils::QueryLayoutGridManager
ICJKGridPainter
1..*
<<boss class>>
kPageBoss
0..1
IMasterPage::GetMasterPageUID
IMasterPage
ICJKGridPrefs
ICJKGridPainter
<<boss class>>
kWorkspaceBoss
ICJKGridPainter::QueryDrawCJKGrid
1
IPageList::GetNthPageUID
ICJKLayoutGridDefaults
<<boss class>>
kDefaultCJKGridDrawBoss
1
ICJKGridData
ICJKLayoutGridData
1
ICJKGridUtils
1
ICJKGridUtils::QueryLayoutGrid
<<boss class>>
kUtilsBoss
1
To obtain regular pages, navigate to kPageBoss
from IPageList (kDocBoss), or via the spread
of interest in the document hierarchy.
To obtain master pages, navigate to a regular
page first (kPageBoss) and call IMasterPage::
GetMasterPageUID, or via the master spread
layer in the document hierarchy.
Master pages may be based on other master
pages, so you may need to call IMasterPage::
GetMasterPageUID until you get kInvalidUID.
ICJKGridUtils::QueryLayoutGrid returns
an interface on the kPageBoss (could be
a master page or a non-master) that
defines the layout grid parameters.
Commands and Notification
The following are layout grid related commands:
Japanese Feature Additions for InDesign
19
Japanese Feature Additions for InDesign
Japanese Layout: Layout Grids
TABLE 1.2 kSetCJKGridDataCmdBoss
Purpose:
To set grid data for a layout grid or a frame grid.
Also calls:
If the command is called on a story or a multicolumn frame (see ItemList Input below),
then kApplytoAttributeListCmdBoss and kApplyStoryThreadStyleCmdBoss are also
processed. The attributes used in kApplytoAttributeListCmdBoss are from the named
grid if the story is based on one, otherwise are based on the settings in the story’s
ICJKGridData. Also, if the command is called on a story and if the frame grid for the
story is based on a named grid, then kSetCJKGridDataCmdBoss is processed on the
named grid to notify observers, so that the frame grid character count is recalculated.
Interfaces:
•
•
•
•
INamedGridUID: (Required) You can specify kInvalidUID, or the UID of a named
grid to use as a base for the grid settings. (INamedGridUID is an alternate means
of specifying the data when the source data is a named grid.) Specify the command
data with a UID via IID_INAMEDGRIDUID and the command will instantiate
the given UID, ignoring IID_IFILTEREDCJKGRIDCMDDATA if it gets a valid
instance. If valid UID, the named grid must be on the same database. The
command will use the ICJKGridData from the UID, then query the class for
INamedGridUID and set that UID as well.
IInterfaceIDData: (Optional) Specifies which IID to modify on the target item(s)
in the ItemList. (In some bosses, ICJKGridData is provided under a different IID,
such as IID_ITRACKINGCJKGRIDDATA on kDocBoss.) If none are specified, the
command will use IID_ICJKGRIDDATA as a default.
IFilteredCJKGridCmdData: (Required) Used to filter specific grid settings to the
destination. You must call SetFieldValid() for the fields you want to apply (with
valid = kTrue) with this command, then call the specific Set***() methods.
IWhenToRecalcCJKGrid: (Not used)
ItemList Input:
A list of UIDs of any boss class with ICJKGridData (kPageBoss, kMultiColumnItemBoss,
kTextStoryBoss). All items must be on the same database.
Observer Notification:
theChange = kSetCJKGridDataCmdBoss, protocol = IID_ICJKGRIDDATA. Subjects for
the items on the item list and the document – if the item is a kTextStoryBoss or
kNamedGridBoss – are notified.
ItemList Output:
(None)
Command usage sample:
SnpModifyLayoutGrid.cpp (SnippetRunner plug-in)
TABLE 1.3 kSetCJKGridPainterCmdBoss
20
Purpose:
Sets the CJKGridPainter implementation for a layout grid or frame grid.
Also calls:
(None)
Interfaces:
•
ItemList Input:
A list of UIDs of boss classes with ICJKGridPainter. All items must be from the same
database.
IClassIDData: (Required) The ClassID that has the desired ICJKGridPainter
implementation.
Japanese Feature Additions for InDesign
Japanese Layout: Layout Grids
Observer Notification:
theChange = kSetCJKGridPainterCmdBoss, protocol = IID_ICJKGRIDPAINTER.
Subjects for the items on the item list are notified.
ItemList Output:
(None)
Command usage sample:
(None)
TABLE 1.4 kSetCJKGridPrefsCmdBoss
Purpose:
Sets the preferences for layout grids (Character Grids) in the Preferences dialog.
Also calls:
(None)
Interfaces:
•
•
ItemList Input:
UIDs of any boss class with ICJKGridPrefs (either kWorkspaceBoss or
kDocWorkspaceBoss).
Observer Notification:
theChange = kSetCJKGridPrefsCmdBoss, protocol = IID_ICJKGRIDPREFS. Subjects for
the items on the item list are notified.
ItemList Output:
(None)
Command usage sample:
SnpModifyLayoutGrid.cpp (SnippetRunner plug-in)
ICJKGridPrefs: (Required) Preference settings.
IUIDData: (Not used)
TABLE 1.5 kSetCJKLayoutGridDataCmdBoss
Purpose:
Sets the ICJKLayoutGridData on kPageBoss.
Also calls:
(None)
Interfaces:
•
ItemList input:
A list of UIDs of pages (kPageBoss, which can be a master page or a regular page). All
items must be on the same database.
Observer Notification:
theChange = kSetCJKLayoutGridDataCmdBoss, protocol =
IID_ICJKLAYOUTGRIDDATA. Only the document’s ISubject is notified.
ItemList Output:
(None)
Command usage sample:
SnpModifyLayoutGrid.cpp (SnippetRunner plug-in)
ICJKLayoutGridData: (Required) Specifies the layout grid data settings. Using the
SetUseMaster() method, you can specify if this page’s layout grid will still use the
layout grid from its master page.
TABLE 1.6 kSetCJKLayoutGridDefaultsCmdBoss
Purpose:
To set the default layout grid settings on a workspace boss (kDocWorkspaceBoss, or
kWorkspaceBoss)
Also calls:
(None)
Japanese Feature Additions for InDesign
21
Japanese Feature Additions for InDesign
Japanese Layout: Layout Grids
Interfaces:
•
ICJKLayoutGridDefaults: (Required) Default settings for the layout grid to copy
from. The copy destination is the same interface on the item on the ItemList.
ItemList Input:
UID of either kDocWorkspaceBoss or kWorkspaceBoss (both have
ICJKLayoutGridDefaults).
Observer Notification:
theChange = kSetCJKLayoutGridDefaultsCmdBoss, protocol =
IID_ICJKLAYOUTGRIDDEFAULTS. Subjects for the items on the item list are notified.
ItemList Output:
(None)
Command usage sample:
SnpModifyLayoutGrid.cpp (SnippetRunner plug-in)
Working with Layout Grids
How to set layout grid settings when creating a new document with
kNewDocCmdBoss
Setting up layout grid settings for a new document is a two-step process.
First, you create a document using the kNewDocCmdBoss command and the
INewDocCmdData interface, just like you would with a document that only has margins and
columns. During this time, a new doc responder service for CJK copies grid defaults from the
global workspace into the document workspace. After creating a new document, you call the
following commands to setup extra layout grid data on the default master page for the
document (using a compound sequence command kCompoundSequenceCmdBoss so that the
grid settings can be undone in one step).
•
kSetCJKLayoutGridDataCmdBoss
•
kSetCJKGridDataCmdBoss
•
kSetPageMarginsCmdBoss
•
kSetColumnGutterCmdBoss
•
kSetPageColumnsCmdBoss
During this command sequence, the page margins, column gutters, and page columns settings
are calculated based on the layout grid settings (e.g. number of characters per line, number of
lines, grid direction, grid starting point and number of columns)
For an example of how this is done, refer to the SnpModifyLayoutGrid.cpp code snippet.
How to change layout grid settings for a specific page or master page
The process of changing the layout grid settings for a specific page, whether it is a non-master
page or a master page, is similar to the second part of the previous how-to item. You process
the following commands (in a compound command sequence), if you want the grid and
margins to align:
22
•
kSetCJKLayoutGridDataCmdBoss
•
kSetCJKGridDataCmdBoss
Japanese Feature Additions for InDesign
Japanese Layout: Layout Grids
•
kSetPageMarginsCmdBoss
•
kSetColumnGutterCmdBoss
•
kSetPageColumnsCmdBoss
For an example of how this is done, refer to the SnpModifyLayoutGrid.cpp code snippet.
Before you process these commands, however, you must decide if you want to change the
layout grid settings on a specific page or change the settings on its master page. If you change
the settings on a specific page that was using a master, the layout grid settings will be different
from the settings of its master page. Also, note that master pages can be nested (i.e. a master
page can be based on another master page).
To find out if a specific page is using layout grid settings from its master page, query the
ICJKLayoutGridData interface on kPageBoss, and call the GetUseMaster() method.
•
If kFalse, the ICJKGridData on the current kPageBoss has the layout grid settings.
•
If kTrue, you can use ICJKGridUtils::QueryLayoutGrid() (for the thePage parameter, pass
in any interface on the current kPageBoss) to query for an interface on the master page
boss (again, kPageBoss).
For an example of checking for the master page that contains the actual layout grid settings of a
specific page, refer to the SnpInspectLayoutGrid.cpp code snippet.
How to get layout grid settings for a specific page (master page or a specific page)
Layout grid settings are accessible via the ICJKLayoutGridData interface on kPageBoss. You
can query for the ICJKLayoutGridData and ICJKGridData on the kPageBoss that has the actual
layout grid data for your page. An easy way to do this is to use the
ICJKGridUtils::QueryLayoutGridData() method (kUtilsBoss), which returns a specific
interface on the kPageBoss that defines layout grid data, even if it is from a master page of a
master page of another master page.
// thePage is some interface on kPageBoss of a non-master
page
// query for ICJKLayoutGridData -// uses default PMIID value from QueryLayoutGrid
InterfacePtr<ICJKLayoutGridData>
gridData((ICJKLayoutGridData*)Utils<ICJKGridUtils>()->
QueryLayoutGrid(thePage));
// query for ICJKGridData -// uses specific PMIID value
InterfacePtr<ICJKGridData>
gridData((ICJKGridData*)Utils<ICJKGridUtils>()->
QueryLayoutGrid(thePage, IID_ICJKGRIDDATA));
For an example of getting layout grid settings for a specific page, refer to the
SnpInspectLayoutGrid.cpp code snippet.
Japanese Feature Additions for InDesign
23
Japanese Feature Additions for InDesign
Japanese Layout: Frame Grids
Japanese Layout: Frame Grids
Description of workflow and various Frame Grid settings
You can create text frames with gridded visual aids in InDesign CS-J, so the user can see if the
characters are being fitted properly into a text frame. Such text frames are called “frame grids”.
A frame grid carries with it two types of adornments:
1.
Character guide adornments (grid, lines, or N/Z), and
2.
Character count (number of characters times number of lines, displayed outside the
bottom left corner of the frame).
You can think of frame grid settings to be a property of a text frame (kMultiColumnItemBoss).
Frame grid setting defaults and preferences are stored in both the document and global
workspaces. Frame grids also affect text attributes and aligns text lines to the grid depending on
how the grid alignment attribute is set.
In InDesign CS-J, a user can create a frame grid by:
•
Using the Horizontal or Vertical Grid Tool to lay down a frame grid. In this case, the size
of the frame grid is constrained to accommodate an integer number of lines and
characters per line.
•
Right-clicking on a text frame (while the Selection tool is selected) to bring up the context
menu, and select the Frame Type >> Frame Grid menu option, or you select the Object >>
Frame Type >> Frame Grid menu option while a text frame is “selected” (either by using
the Selection tool or by having a text caret in a text frame).
When creating a new frame grid using the Horizontal or Vertical frame grid tool, if [Layout
Grid] is selected in the Named Grids panel, the default text-related grid settings are carried
over from the corresponding layout grid settings of the page selected in the Pages panel.
(NOTE: This algorithm uses ILayoutUtils::GetSelectedPages() to determine on which page to
base the layout grid settings. If multiple pages are selected in the Pages panel, the algorithm
automatically picks the first in the list of selected pages.) If a specific named grid is selected in
the Named Grids panel, then the settings from the selected named grid are applied to the newly
created frame grid. Otherwise, the default frame grid settings from the document workspace
are applied to the newly created frame grid. When you programmatically create a frame grid,
you can decide how to set the grid settings yourself.
When you show the options for one of the frame grid tools, or right-click on a frame grid and
select the Frame Grid Settings menu, you will see the Frame Grid Settings dialog, which looks
like this.
24
Japanese Feature Additions for InDesign
Japanese Layout: Frame Grids
FIGURE 1.4
Frame Grid Settings Dialog (with references to model interfaces)
The top most group of widgets on this dialog is where the user specifies the text characteristics
for the frame grid, including font family and style, size, vertical and horizontal scales, character
spacing, and line spacing. This is very similar to the Layout Grid Settings dialog, except that
you don’t specify the default story direction (vertical or horizontal) in this dialog.
The middle group of widgets is where the user specifies alignment characteristics, including
grid alignment, text alignment and character hang.
In between the middle group and the bottom group is a pull-down menu where the user
specifies the frame grid adornment options (grid, N/Z, lines only, and grid with N/Z). (“N/Z”
refers to a diagonal line placed across the entire frame when there is no text in it. If the frame is
a vertical frame, the direction of the diagonal line is like an “N” (starts from top left and goes to
the bottom right), and if the frame is a horizontal frame, the diagonal line is like a “Z”.)
The bottom most group of widgets is where the user specifies grid characteristics, including the
number of characters per line, number of lines, number of columns, and the column spacing.
Below the bottom group, the dimensional data of the frame grid, based on all of the above
settings is calculated and displayed in a static text widget.
This diagram also shows the various model interfaces that correspond to the data set by the UI
widgets. The line and column count settings in the bottom frame, along with the
ICJKGridData settings in the top frame, collectively determine the column and frame
bounding box settings. The result is a frame grid sized to the user’s specifications. The resulting
size of the frame grid bounding box is displayed at the very bottom of the dialog (height x
width, in mm).
Japanese Feature Additions for InDesign
25
Japanese Feature Additions for InDesign
Japanese Layout: Frame Grids
Interactions between Frame Grid settings and the Text Model
Starting with InDesign CS, the text model relies on Frame Grid settings to produce some of the
text attributes, therefore affecting the paragraph composer’s behavior. Say you have a frame
grid which has settings based on a named grid. The text attributes stored on the ITextAttributes
interface (aggregated on kNamedGridBoss) get injected early in the text attribute chain if there
is no paragraph style set. Some of the new methods on IGridRelatedStyle (such as
GetScaleAffectsLineHeight() and SetScaleAffectsLineHeight()) on
kComposeStyleBoss (see Japanese-specific additions into kComposeStyleBoss) are a result of this
new approach. See kSetCJKGridDataCmdBoss for a list of commands that get called to set text
attributes when frame grid data is set.
Class Diagram
Here are the boss classes and interfaces that are related to frame grids.
kDocWorkspaceBoss and kWorkspaceBoss
kDocWorkspaceBoss and kWorkspaceBoss aggregate interfaces that store the default frame
grid settings. kWorkspaceBoss stores the application defaults. When a new document is
created, that document’s kDocWorkspaceBoss inherits the default frame grid settings from
kWorkspaceBoss If a user modifies the default frame grid settings on that document, only the
layout grid settings in kDocWorkspaceBoss are modified. This default is used when using one
of the frame grid tools to draw a frame grid.
26
•
ICJKFrameGridDefaults: Stores the default settings for frame grids, such as text size, font,
and aki data.
•
ICJKGridPrefs: Stores the document-wide character grid preferences, such as the shape of
each character cell, a flag that indicates if all frame grids should be shown, etc.
•
IStyleNameTable (IID_INAMEDGRIDSNAMETABLE): Stores UIDs of named grid styles
that are added to the Grid Format panel. The UIDs refer to instances of the
kNamedGridBoss.
Japanese Feature Additions for InDesign
Japanese Layout: Frame Grids
•
INamedGridUID: Stores the UID of the default named grid. This UID refers to a specific
instance of kNamedGridBoss.
kNamedGridBoss
kNamedGridBoss is a persistent boss class that represents a named grid in the style name table.
•
ICJKGridData: Stores the text-related grid settings for the named style.
•
ITextAttributes: Stores the text attributes that affect text composition, so that they could
be applied to the text story that uses this named grid. (See kSetCJKGridDataCmdBoss.)
•
INamedGridInfo: Stores the name and keyboard shortcut for the named grid style.
•
IPMPersist: Allows the named grid data to be persisted into a database.
kTextStoryBoss
kTextStoryBoss aggregates the frame grid settings specific to a story. This implies that a text
story can have only frame grid setting, even if it is composed across multiple linked frames.
•
ICJKGridData: Stores the real grid settings for a text story. You can have these grid
settings applied to the entire story when the text is set across linked frame grids.
•
INamedGridUID: Stores the UID of the named grid associated with this story.
•
IObserver (IID_ICJKGRIDSTORYOBSERVER): (For internal use) When the frame is
overset, this observer updates the frame grid character count adornment upon insertion
or deletion of text. (The normal updating of the character count adornment is done when
the frame is drawn.)
•
IStoryOptions: GetCJKGridActive() returns the state of the grid on the story boss.
(kActivateCJKGridCmdBoss is the command to set this.)
•
ITextAttributes: Stores the default text attributes of this story. If the frame grid associated
with a story is based on a name grid, the ITextAttributes on kNamedGridBoss get
appended to this list. (See kSetCJKGridDataCmdBoss.)
Japanese Feature Additions for InDesign
27
Japanese Feature Additions for InDesign
Japanese Layout: Frame Grids
kFrameItemBoss
kFrameItemBoss aggregates interfaces related to the frame grid drawing.
•
ICJKGridPainter: Stores the Grid Painter boss class ID for the specific frame. You can set
the grid painter boss class ID by processing kSetCJKGridPainterCmdBoss. The boss class
specified must aggregate an implementation of the IDrawCJKGrid interface. (The
application-provided implementation of IDrawCJKGrid is in
kDefaultCJKGridDrawBoss.)
•
ICJKGridManager: The grid manager for a frame. Provides calculated results of grid
settings.
kMultiColumnItemBoss
kMultiColumnItemBoss stores a copy of the frame grid related settings from the associated text
story, as well as a few grid adornment display options.
28
•
ICJKGridData: Stores the cached grid settings specific to a text frame. (This interface
actually gets the data from the kTextStoryBoss for the text story that is set in this
multicolumn item, so this interface is aggregated here only for convenience, at the cost of
a small performance overhead.)
•
IAdornmentVisibility (IID_ICJKGRIDVISIBILITY): Sets the visibility of the frame grid
adornment for the grid option.
•
IAdornmentVisibility (IID_ICJKALIGNVISIBILITY): Sets the visibility of the frame grid
adornment for the line (alignment) option.
•
IAdornmentVisibility (IID_ICJKZNVISIBILITY): Sets the visibility of the frame grid
adornment for the “N/Z” option.
•
IPMUnknown (IID_ICHARCOUNTSTRINGDATA): Stores the bounds of the character
count adornment that is displayed at the bottom of the frame grid. (This uses a private
interface.)
Japanese Feature Additions for InDesign
Japanese Layout: Frame Grids
Selection Related Bosses and Suite Interfaces
In addition to the model-related bosses listed above, you can manipulate grid-related settings
on the current selection context by using the ICJKGridSuite interface. Its CSBs are aggregated
in the following bosses:
•
kApplicationDefaultSuiteBoss: For setting the default frame grid settings in the
application default workspace, kWorkspaceBoss.
•
kDocumentDefaultSuiteBoss: For setting the default frame grid settings in the document
workspace, kDocWorkspaceBoss.
•
kLayoutSuiteBoss: For setting frame grid settings related to a layout selection (i.e. A text
frame is selected)
•
kTextSuiteBoss: For setting frame grid settings related to a text selection (i.e. Text in a text
frame is selected)
•
kGalleyTextSuiteBoss: For setting frame grid settings related to a selection in the galley
view (InDesign story editor). (NOTE: The menu item to show the frame grid dialog is
disabled from the UI.)
For more details on using suite interfaces and the ISelectionUtils utility interface, refer to the
InDesign CS SDK Technote titled “Selection”.
Navigation Diagram
This diagram shows how to navigate from one frame grid related boss to another.
Japanese Feature Additions for InDesign
29
Japanese Feature Additions for InDesign
Japanese Layout: Frame Grids
FIGURE 1.5
Navigation Diagram for the Frame Grid Model
Document
ICJKFrameGridDefaults
ICJKGridPrefs
<<boss class>>
kDocWorkspaceBoss
IStoryList
IStyleNameTable (IID_INAMEDGRIDSNAMETABLE)
1
IStyleNameTable::GetNthStyle
ICJKGridData
INamedGridInfo1..*
1
<<boss class>>
kNamedGridBoss
ITextAttributes
0..1
IStoryList::GetNthUserAccessibleStoryUID
IFrameList::QueryNthFrame
IFrameList INamedGridUID::Get
ICJKGridData
1
ITextModel::QueryFrameList
1
1
IHierarchy
1
<<boss class>>
kFrameListBoss
<<boss class>>
kMultiColumnItemBoss
1
ITextModel
IStoryOptions
ICJKGridData
ITextFrame
IHierarchy::QueryParent
IHierarchy
1..*
<<boss class>>
kTextStoryBoss
<<boss class>>
kFrameItemBoss
ICJKGridManager
ICJKGridPainter
0..*
INamedGridUID
ITextAttributes
1
This refers only to user
accessible text stories.
ICJKFrameGridDefaults
IStyleNameTable (IID_INAMEDGRIDSNAMETABLE)
1
<<boss class>>
kWorkspaceBoss
IStyleNameTable::GetNthStyle
ICJKGridPrefs
ICJKGridData
INamedGridInfo
1..*
<<boss class>>
kNamedGridBoss
Commands and Notification
The following are general frame grid commands:
30
•
kActivateCJKGridCmdBoss
•
kSetAdornmentVisibilityCmdBoss
The ITextFrame returned from
IFrameList::QueryNthFrame •may
be a kTOPFrameItemBoss
(text-on-path item), however,
TOP frame items do not have
frame grid properties, so they
have been omitted from this diagram.
Japanese Feature Additions for InDesign
Japanese Layout: Frame Grids
•
kSetCJKGridDataCmdBoss (This command is used for both layout and frame grids.)
•
kApplyCJKGridFormatCmdBoss
•
kSetCJKFrameGridDefaultsCmdBoss
•
kSetDefaultFrameGridViewCmdBoss
The following are named grid commands:
•
kCopyOneNamedGridCmdBoss
•
kCreateNamedGridCmdBoss
•
kDeleteNamedGridCmdBoss
•
kEditNamedGridCmdBoss
•
kLoadNamedGridsCmdBoss
•
kReplaceNamedGridCmdBoss
TABLE 1.7 kActivateCJKGridCmdBoss
Purpose:
Activates/deactivates frame grids when creating a text frame (or, turns a newly created
text frame into a frame grid) by setting IStoryOptions:: SetCJKGridActive().
Also calls:
kSetCJKGridDataCmdBoss, kUserApplyAttrCmdBoss, kSetAdornmentVisibilityCmdBoss
Interfaces:
•
•
•
IBoolData: (Required) Activate grid – kFalse or kTrue. This calls
IStoryOptions::SetCJKGridActive().
INamedGridUID: (Optional) The base named grid to use if the item on the item
list is kTextStoryBoss AND grids were not previously enabled on the story.
IFilteredCJKGridCmdData: (Optional) The extra grid data settings to use if the
item on the item list is kTextStoryBoss AND grids were not previously enabled on
the story. Use the SetFieldValid() method to specify which data fields are to be
applied.
ItemList Input:
UIDs of any boss class with IStoryOptions (kTextStoryBoss, kDocWorkspaceBoss,
kWorkspaceBoss). All items must have the same database.
Observer Notification:
theChange = kActivateCJKGridCmdBoss, protocol = IID_ISTORYOPTIONS. Subjects
for the items on the item list and the document – if the item is a kTextStoryBoss – are
notified.)
ItemList Output:
Not applicable
Command usage sample:
SnpCreateFrameGrid.cpp (SnippetRunner plug-in)
TABLE 1.8 kSetAdornmentVisibilityCmdBoss
Purpose:
To set the type of adornments that are shown on a frame grid.
Also calls:
None
Japanese Feature Additions for InDesign
31
Japanese Feature Additions for InDesign
Japanese Layout: Frame Grids
Interfaces:
•
•
•
IAdornmentVisibility: (Required) Call SetVisible() with the desired bool16 value
to show or hide a particular grid adornment. Also see IInterfaceIDData.
IInterfaceIDData: (Required) Specifies the type of adornment that should be made
visible or invisible. The allowed values are: IID_ICJKALIGNVISIBILITY (text line
adornments, IID_ICJKGRIDVISIBILITY (grids), and IID_ICJKZNVISIBILITY
(“ZN” adornment, or diagonal lines).
IWhenToRecalcCJKGrid: (Not used)
ItemList Input:
A list of UIDs of kMultiColumnItemBoss (as the above mentioned IIDs are aggregated
on this boss). All items must be on the same database.
Observer Notification:
theChange = kSetAdornmentVisibilityCmdBoss, protocol =
IID_IADORNMENTVISIBILITY. Subjects for the items on the item list are notified.
ItemList Output:
(None)
Command usage sample:
(None)
TABLE 1.9 kApplyCJKGridFormatCmdBoss
Purpose:
Applies frame grid format to currently selected text frame.
Also calls:
kUserApplyAttrCmdBoss
Interfaces:
•
•
•
32
IBoolData: (Required) If set to kTrue, ignore IRangeData and apply grid to entire
story
IApplyCJKGridDirection: (Optional) Specifies the direction of the grid for the
items on the item list. You can use this to force the grid to apply attributes in a
direction other than that of the story. See IApplyCJKGridDirection for more
information.
IRangeData: (Optional) Specifies the text range data on which the text-related grid
attributes are to be copied, which include: (Character attributes)
kTextAttrFontUIDBoss, kTextAttrFontStyleBoss, kTextAttrPointSizeBoss,
kTextAttrXGlyphScaleBoss, kTextAttrYGlyphScaleBoss,
kTAScaleAffectsLineHeightBoss, kTACJKGridTrackingBoss, kTextAttrLeadBoss,
and kTextAttrCharacterHangBoss; (Paragraph attributes)
kTextAttrGridAlignmentBoss, kTextAttrAutoLeadBoss, and
kTextAttrAlignmentBoss.
ItemList Input:
UIDs of any boss class with ITextModel and ICJKGridData (e.g. kTextStoryBoss).
Observer Notification:
(None)
ItemList Output:
(None)
Command usage sample:
SnpCreateFrameGrid.cpp (SnippetRunner plug-in)
Japanese Feature Additions for InDesign
Japanese Layout: Frame Grids
TABLE 1.10 kSetCJKFrameGridDefaultsCmdBoss
Purpose:
The command either sets the workspace’s INamedGridUID or ICJKFrameGridDefaults.
If INamedGridUID has a UID that is kInvalidUID, the defaults are set using
ICJKFrameGridDefaults and INamedGridUID is set to invalid. If INamedGridUID is
valid, the command sets the workspace’s INamedGridUID to the designated UID.
Also calls:
(None)
Interfaces:
•
•
INamedGridUID: (Required) Specifies the default named grid style. If set to
kInvalidUID, the command gets the default frame grid setting from
ICJKFrameGridDefaults.
ICJKFrameGridDefaults: (Optional) Specifies the alternate default settings, if
INamedGridUID is set to kInvalidUID.
ItemList Input:
Either kWorkspaceBoss or kDocWorkspaceBoss.
Observer Notification:
theClass = kSetCJKFrameGridDefaultsCmdBoss, and protocol =
IID_INAMEDGRIDUID (if INamedGridUID is valid) or
IID_ICJKFRAMEGRIDDEFAULTS (if INamedGridUID is invalid). The subjects of the
items on the ItemList are notified.
ItemList Output:
(None)
Command usage
samples:
(None)
TABLE 1.11 kSetDefaultFrameGridViewCmdBoss
Purpose:
Sets the default frame grid adornment options on a workspace, by calling
ICJKFrameGridDefaults::SetView().
Also calls:
(None)
Interfaces:
•
ItemList Input:
Either kWorkspaceBoss or kDocWorkspaceBoss.
Observer Notification:
theChange = kSetDefaultFrameGridViewCmdBoss, protocol =
IID_ICJKFRAMEGRIDDEFAULTS. The subjects of the items on the ItemList are
notified.
ItemList Output:
(None)
Command usage
samples:
(None)
IIntData: (Required) Specifies the frame grid option
(ICJKFrameGridDefaults::View enum).
TABLE 1.12 kCopyOneNamedGridCmdBoss
Purpose:
Copies a named grid style from one database to another.
Also calls:
kNewUIDCmdBoss
Japanese Feature Additions for InDesign
33
Japanese Feature Additions for InDesign
Japanese Layout: Frame Grids
Interfaces:
•
IUIDData: (Required) The UID of the named grid boss to copy from.
ItemList Input:
The ItemList should contain a UID on the document to copy the named grid boss to.
The UID can be anything on the document, since the command gets the document and
its workspace via the database root object.
Observer Notification:
theChange = kCopyOneNamedGridCmdBoss, protocol =
IID_INAMEDGRIDSNAMETABLE. The document workspace at the copy destination is
notified.
ItemList Output:
The newly copied named grid boss UID.
Command usage
samples:
(None)
TABLE 1.13 kCreateNamedGridCmdBoss
Purpose:
Creates a new named grid on a workspace. If one exists with the same name, this
command will not create one (and throw a benign assert).
Also calls:
(None, directly creates a new UID on the database)
Interfaces:
•
•
ItemList Input:
A UID of the workspace (kDocWorkspace or kWorkspace) on which the named grid is to
be created.
Observer Notification:
theChange = kCreateNamedGridCmdBoss, protocol =
IID_INAMEDGRIDSNAMETABLE. The subject of the item on the ItemList is notified.
ItemList Output:
None. To get the newly created named grid, obtain the latest entry on the workspace’s
IID_INAMEDGRIDSNAMETABLE.
Command usage
samples:
SnpPerformNamedGrid.cpp (SnippetRunner plug-in)
ICJKGridData: (Required) The grid settings for the new named grid.
INamedGridInfo: (Required) The named grid info for the new named grid.
TABLE 1.14 kDeleteNamedGridCmdBoss
34
Purpose:
Deletes the named grid from the workspace, and also sets all references to the named grid
to kInvalidUID (See ItemList Input for details).
Also calls:
kDeleteUIDsCmdBoss
Interfaces:
•
ItemList Input:
UID for a single workspace (kDocWorkspaceBoss or kWorkspaceBoss). Only one
workspace should be in the item list. If the workspace is kDocWorkspaceBoss, the
command removes references to the named grid from the stories in the same document
and the default frame grid settings (if the said named was specified). If the workspace is
kWorkspaceBoss, the command removes references from the global workspace’s default
frame grid settings.
IUIDData: (Required) The UID of the named grid to delete.
Japanese Feature Additions for InDesign
Japanese Layout: Frame Grids
Observer Notification:
theChange = kDeleteNamedGridCmdBoss, protocol =
IID_INAMEDGRIDSNAMETABLE. The subject on the workspace passed into the
ItemList is notified.
ItemList Output:
(None)
Command usage
samples:
SnpPerformNamedGrid.cpp (SnippetRunner plug-in)
TABLE 1.15 kEditNamedGridCmdBoss
Purpose:
Changes the name of a named grid.
Also calls:
(None)
Interfaces:
•
ItemList Input:
The UID of the named grid to modify.
Observer Notification:
theChange = kEditNamedGridCmdBoss, protocol = IID_INAMEDGRIDINFO. If the
named grid is on the document workspace (kDocWorkspaceBoss), the ISubject on
kDocWorkspaceBoss is used. If the named grid is on the global workspace, the ISubject
on kWorkspaceBoss is used.
ItemList Output:
(None)
Command usage
samples:
(None)
IStringData: (Required) The new name for the named grid.
TABLE 1.16 kLoadNamedGridsCmdBoss
Purpose:
Reads name grids from another InDesign document.
Also calls:
kOpenDocCmdBoss, kCreateNamedGridCmdBoss, kReplaceNamedGridCmdBoss,
kEditNamedGridCmdBoss
Interfaces:
•
•
ISysFileData: (Required) The SysFile from which the command will obtain named
grid data.
IIntData: (Required) Set to ILoadStyleCmdData::kLoadNamedGridsTable.
ItemList Input:
The UID of the target workspace where the named grids will be appended or modified.
Observer Notification:
(None)
ItemList Output:
(None)
Command usage
samples:
(None)
TABLE 1.17 kReplaceNamedGridCmdBoss
Purpose:
Replaces named grids across multiple databases.
Japanese Feature Additions for InDesign
35
Japanese Feature Additions for InDesign
Japanese Layout: Frame Grids
Also calls:
kSetCJKGridDataCmdBoss
Interfaces:
•
ItemList Input:
(Not needed)
Observer Notification:
(None)
ItemList Output:
(None)
Command usage
samples:
(None)
ILoadStyleCmdData: (Required) Specifies the source and destination name tables
and the named style (named grid UID). The source has the named grid to copy
from.
Working with Frame Grids
How to create a new frame grid
First, create a multicolumn item using kCreateMultiColumnItemBoss, just like you would as if
you were creating just a regular text frame. Then, perform these extra steps:
•
In setting up the parameters for kCreateMultiColumnItemBoss, set
ICreateFrameData::SetOrientation() to either ICreateFrameData::kVertical or
ICreateFrameData::kHorizontal to specify frame grid direction.
•
Process kActivateCJKGridCmdBoss on the text stories associated with the multicolumn
item.
•
Optionally process kApplyCJKGridFormatCmdBoss to apply the new grid format onto the
story in the text frame.
See kActivateCJKGridCmdBoss for details. Also, for an example on how this is done, refer to the
SnpCreateFrameGrid.cpp snippet (SnipeptRunner plug-in).
NOTE: The snippet processes kActivateCJKGridCmdBoss twice - once on the document
workspace to activate grids, and another time to deactivate grids. You can instead process
kActivateCJKGridCmdBoss just once after processing kCreateMultiColumnItemBoss, if you
pass in the kTextStoryBoss UID into the item list of the kActivateCJKGridCmdBoss command.
How to change an existing text frame to a frame grid
The process is similar to the steps described in How to create a new frame grid. To set the frame
direction, you will have to process kSetVertFrameCmdBoss with the UID of the multicolumn
item’s frame list. This is because you will not have an ICreateFrameData interface to set the
frame direction, as you are not making a brand new multicolumn item.
How to get the default frame grid settings from a workspace
Query for the ICJKFrameGridDefaults interface from a workspace (kDocWorkspaceBoss or
kWorkspaceBoss). Note that the ICJKFrameGridDefaults interface inherits from
ICJKGridData, which is a general purpose interface for grid settings. (General purpose because
it is used for layout grids and frame grids.)
36
Japanese Feature Additions for InDesign
Japanese Layout: Measurement Units
How to get the frame grids settings from a story
The frame grid settings are set on the text story (kTextStoryBoss), so you can query for
ICJKGridData from kTextStoryBoss and call the accessor methods on ICJKGridData. You can
use ICJKGridData:: GridDataMatches() or ICJKGridData::NonAlignmentGridDataMatches()
methods to compare with another ICJKGridData.
How to change the writing direction of a frame grid
Process kSetVertFrameCmdBoss with the UID of the multicolumn item’s frame list.
How to create a named grid style and how to get it
To create a named grid style, process the kCreateNamedGridCmdBoss. See the topic titled
Commands and Notification earlier in this section for details.
To get a named grid style, query for the IStyleNameTable (IID_INAMEDGRIDSNAMETABLE)
on either the kDocWorkspaceBoss or the kWorkspaceBoss, and obtain the UID of the desired
named grid style by name, index, default, or root. Then instantiate the boss referred to by the
obtained UID, which should be kNamedGridBoss. See the topic titled Class Diagram earlier in
this section for interfaces aggregated on this boss. Also, for an example on how this is done,
refer to the SnpPerformNamedGrid.cpp snippet (SnipeptRunner plug-in).
Japanese Layout: Measurement Units
Description of Special Japanese Measurement Units
The world of Japanese typesetting even has a unique set of measurement units. The
measurement unit for character sizes is known as “kyu”,( 級 ), denoted by the unit symbol “Q”,
and literally means “class”. One "Q" equals 0.25mm. (There is a theory that the unit symbol
actually came from the fact that 1Q equals a "quarter" of a millimeter.) The measurement unit
for character and line spacing is known as “Ha”( 歯 ), which literally means “teeth”, and is
commonly abbreviated as “H”. This unit used to refer to distance of the print medium that was
moved by the gears in the typesetting machines, particularly when line and character spacings
were to be adjusted. Along with Q and Ha, another commonly used measurement unit is the
American Point.
These units were carried into the world of modern Japanese DTP when specifying text-related
measurements.
Both 1 H and 1 Q are defined to be exactly 0.25mm, and American Points (AP) is defined to be
0.3514mm (just slightly shorter than 1/12th of a pica) by the Japan Institute of Standards (JIS).
NOTE: Refer to JIS Specification Z8505 for the definition of AP.
Japanese Feature Additions for InDesign
37
Japanese Feature Additions for InDesign
Japanese Layout: Measurement Units
Conversion Table
TABLE 1.18 Measurement Unit Conversion Table
UNIT
1 Point in unit (rounded to 4 significant digits)
1 unit in Points (rounded to 4 significant digits)
Ha
4 (Ha/mm) * 25.4 (mm/inch)/ 72
(points/inch) or 1.4111
72 (points/inch) / 25.4 (mm/inch) / 4
(Ha/mm), or 0.7087
Q
4 (Q/mm) * 25.4 (mm/inch)/ 72
(points/inch) or 1.4111
72 (points/inch) / 25.4 (mm/inch) / 4
(Q/mm), or 0.7087
AP
25.4 (mm/inch) / 72(AP/inch) / .3514
(mm/AP) or 1.0039
.3514 (mm/AP) * 72 (AP/inch) / 25.4
(mm/inch), or 0.9961
Class Diagram
Here are the boss classes and interfaces that are related to Japanese measurement units.
IUnitOfMeasure
<<boss class>>
kAPBoss
IK2ServiceProvider
Identifies this boss as a
IUnitOfMeasure kService_UnitOfMeasure
service provider.
<<boss class>>
kHaBoss
IK2ServiceProvider
IUnitOfMeasure
<<boss class>>
kQBoss
IK2ServiceProvider
Where these units are used
These units are used by default in the following UIs when running InDesign CS-J.
•
Q: Font size
•
Ha: Text spacing, leading, and other text layout related measurements
•
AP: Not used as a default setting
You can change the default measurement units in the Preferences dialog.
38
Japanese Feature Additions for InDesign
Japanese Typography
Special provisions for documents saved with these units
These measurement unit bosses exist only in the Japanese feature set, however, there are default
unit converters for these built into InDesign’s content manager, and these are specified in the
IgnoreTags resource in the owning plug-in, so users will not be subject to a missing plug-in
alert when a document with these units are opened using a InDesign CS.
Working with Japanese Measurement Units
How to convert from Q/Ha/AP to Points and vice versa
If you can obtain an instance of one of these bosses (for example, using the
CreateObject() function with the specific boss class ID), you can simply call
IUnitOfMeasure::UnitsToPoints() and
IUnitOfMeasure::PointsToUnits() to convert between these units and points. Note
that these boss classes are only available when running InDesign CS-J.
Japanese Typography
Introduction to the Japanese Art of Mojikumi
In the Japanese Layout sections of this chapter, we discussed that Japanese page layouts are
often determined by the grids that show how many characters should be typeset on a page or a
column. This practice is based on how mechanical typesetting practices became established in
the Far East. Through the course of history, the Japanese typesetting professionals developed a
distinct style all to themselves, integrating beauty stemming from the symmetry of the
Japanese characters, along with practicality and efficiency of the ideographic character set. In
this section, we will discover the complex set of Japanese typesetting rules, also known as “moji
kumihan” (文字組版) or “mojikumi” (文字組) for short, and how InDesign allows developers
to utilize them via the API.
Overview of Features
InDesign CS-J provides Japanese-specific text features in the following areas:
•
Text Composition: Japanese single-line composer and paragraph composers, which allow
text composition based on Japanese-specific text composition rules and attributes. These
composers include support for vertical text orientation.
•
Typesetting Rules: Also known as mojikumi tables, these rules are accessible through style
name tables in the global and document workspaces. Based classifications of characters in
mojikumi tables, you can apply different line-breaking rules (kinsoku shori 禁則処理 ),
keep-together rules (bunri-kinshi 分離禁止 ), hanging punctuation rules (burasagari ぶ
ら下がり ), spacing rules (aki 空き ), and kerning rules (tsume 詰め ).
Japanese Feature Additions for InDesign
39
Japanese Feature Additions for InDesign
Japanese Typography
•
Japanese specific Text Attributes: Includes:
•
Text Alignment: Includes the ability to align text with respect to the embox (virtual
typeblock bounds, or “kasou-body” 仮想ボディ ) and ICF box (Ideographic Character
Face, or “heikin-jizura” 平均字面 ) in addition to the Roman baseline, horizontal-invertical text (tate-chuu-yoko 縦中横 ), and in-line annotations (warichu 割注 ).
•
Japanese-style Italicizing: Includes a special optical distortion of characters (shatai 斜体).
•
Other Text Attributes: Includes support for the rotation of Roman characters in vertical
text, input method editor composition modes, insertion of alternate glyphs (itaiji 異体字
) and end-user defined characters (gaiji 外字 ), and setting of various OpenType font
features specific to Japanese characters.
•
Japanese specific Text Adornments: Includes annotations (ruby ルビ ) and emphasis
marks (kenten 圏点 ).
•
Composite Fonts (gousei font 合成フォント ): A meta-font that wraps a set of font faces
used for different kinds of character classes.
Terminology and Definitions
40
•
Kasou-body ( 仮想ボディ ): The Japanese term for embox. Literally means “virtual
(glyph) body (size)”. The Kasou-body is the basis for almost all character size and spacing
calculations as well as text alignment. Each of the grid boxes in the screen shot below
represent the kasou body for a character in the same point size as the grid settings. For
most Japanese fonts, the embox in a 12-point font is defined as a square box 12 points on
a side. In OpenType fonts, the embox information is stored in the font. For other fonts,
InDesign calculates each font’s embox so that text in that font will line up with other
fonts’ emboxes. In many fonts, the embox is defined as a 1000 unit square, with the top at
-880 units and the bottom at 120 units. Other fonts’ emboxes vary in relative location
even if they are the same size, which is why calculating each font’s embox correctly is
essential for correct character placement in Japanese typography.
•
Zenkaku moji ( 全角文字 ); The Japanese term for full-width character, a character that
generally occupies a full kasou-body (em-box).
•
Hankaku moji ( 半角文字 ); The Japanese term for half-width character, a character that
generally occupies 1/2 of a kasou-body (em-box). Generally refers to regular ASCII
alphanumeric characters as well as single-byte katakana characters.
•
Heikin-jizura ( 平均字面 ); ICF Box (Ideographic Character Face): The ICF box is a
digital representation of the font designer’s idea of the average space of ideographs in the
font. It is also used for gridding in traditional layout paper workflows. In OpenType
fonts, the ICF box is stored in the font, otherwise it is approximated by InDesign.
•
Shatai (斜体): Optical obliquing of characters. Unlike italicizing, where the characters are
tilted, shatai is generally set by a combination of the shatai angle and magnification
factor. (See text feature 4 in the screen shot below.)
Japanese Feature Additions for InDesign
Japanese Typography
•
Warichu ( 割注 ): Inline annotations that are added inline to the main line of text. It can
be anywhere from 2-5 lines high, and up to 500 characters long. When a warichu notation
wraps across a main line line break, its lines are composed in reading order according to
complex rules.
•
Gaiji ( 外字 ): End-user defined characters. More details on this will be given in a later
section.
•
Itaiji ( 異体字 ): Alternate forms of the same character. Characters with alternate glyph
forms may or may not use the same Unicode codepoint. Some characters have as many as
23 different glyph forms. A good example is the character “nabe”, the second character in
the Japanese surname Watanabe ( 渡辺 ). (e.g. 辺 , 邉 , 邊 , etc.)
•
Gousei font ( 合成フォント ): The Japanese term for composite fonts, a font made up
from a combination of fonts that are individually used for specific character sets. For
instance, a composite font called “MyCompositeFont” might use Arial Regular for halfwidth alpha numeric characters, but Heisei Kaku Gothic for full-width alpha numerics,
and Kozuka Mincho Std-Heavy for hiragana and kanji characters. More details on this
will be given in a later section.
•
Aki ( 空き ): The spacing between a pair of characters or lines. Since each publishing
house has its own house rules for governing how characters are spaced in the line, and
how lines are broken in the frame, the rules for how aki is distributed in the line are
known as mojikumi aki rules. The mojikumi aki settings dialog in InDesign CS-J is where
the user sets these rules up, and they are applied on a paragraph basis. See “Mojikumi”.
•
Mojikumi ( 文字組 ): Text composition. Specifically, it defines placement behavior for
glyphs that allows the composition engine to observe line break rules. Basically, mojikumi
rules define the amount of aki (space) that appears between different classes of characters;
for example, the space between opening parentheses and the next character might not be
the same as that between two numeric glyphs.
•
Kinsoku Shori ( 禁則処理 ): Line break processing. It defines the relationship between
individual characters and the line break, for example:
•
Gyoutou kinsoku moji (行頭禁則文字): Characters that cannot start a line (e.g. Japanese
period, close parenthesis) (Note the Japanese period in the left-most line in the screen
shot below. Since Japanese periods cannot be placed at the top of a line, it has been forced
into the end of a line. Because of that, the kerning appears to have been tightened in that
line.)
•
Gyoumatsu kinsoku moji ( 行末禁則文字 ): Characters that cannot end a line (e.g. open
parenthesis)
•
Burasage moji ( ぶら下げ文字 ): Characters that are allowed to hang outside the margin
(e.g. half-width punctuation) (See text feature 1 in the screen shot below. The Japanese
comma is an example of a burasage moji.)
•
Bunri-kinshi moji ( 分離禁止文字 ): A pair of characters that cannot be separated by a
line break (e.g. ellipsis characters). There has to be two or more of the same character for
this to take effect. They are not allowed to have space (aki) added to them in fulljustification, and they are not allowed to break across lines.
There are three types of line break processing that can be applied:
Japanese Feature Additions for InDesign
41
Japanese Feature Additions for InDesign
Japanese Typography
—
Oikomi yuusen ( 追い込み優先 ): Push-in first, then push out (compress the
characters on the line first, if a suitable line break cannot be made, attempt to
expand the characters and push glyphs onto the next line)
—
Oidashi yuusen (追い出し優先): Push-out any character that doesn’t fit at line end.
Push out first means if in a full-justified line less than 4/5 of the width of the
kinsoku cluster of characters is hanging, push them out. Otherwise, push them in.
Ragged justification favors pushing out.
—
Oidashi nomi ( 追い出しのみ ): Push the characters out to make the line break.
•
Tsume ( 詰め ): Compression of the space that a character occupies. Unlike character
scaling, “tsume” reduces the space allocated to a character from its em-box to the glyph
bounding box. (The term tsume means many different things in Japanese. In InDesign,
we have mojikumi tsume, which refers to the removing of 1/2 em of width from
punctuation characters to prepare them for the conditional addition of mojikumi aki
spacing. There is also a character attribute called tsume percentage, which is a kind of
bilateral kerning of the character’s width.)
•
Ruby ( ルビ ): A text adornment placed either above or below (or, right or left if the text
flows vertically) a text. The adorned text is called base text. The size of ruby characters is
usually a proportion of the base text. Ruby is typically used to provide phonetic reading
aids in hiragana for uncommon kanji character sequences. Ruby text does not usually
straddle space characters, and the length of a ruby run is likely to be shorter than that of
the base text. (See text feature 5 in the screen shot below.)
•
Kenten ( 圏点 ): A text adornment used to emphasize or distinguish words. There is a one
to one relationship between the base text and the kenten characters that apply. The kenten
size if half that of the base text and is applied to the right hand side of the base text (top
for a horizontal writing direction). (See text feature 6 in the screen shot below.)
•
Tate-chuu-yoko ( 縦中横 ): The ability to set runs of vertical text to run horizontally (for
example, roman numerics). The user can specify a maximum number of alpha numerics
to be displayed automatically as Tate-Chuu-Yoko (this is known as Kumisuuji ( 組み数字
)). (See text feature 3 in the screen shot below.)
Here is a sample text story composed with the Adobe Japanese Single-Line Composer.
42
Japanese Feature Additions for InDesign
Japanese Typography
FIGURE 1.6
Properly composed Japanese text, using the Adobe Japanese Single-Line Composer
The red numbers in the screen shot correspond to the following features:
1.
Burasagari
2.
Japanese-style underline (uses a specific stroke style)
3.
Tate-chu-yoko (roman numerals composed horizontally in vertical text)
4.
Shatai
5.
Ruby
6.
Kenten
Overview of the Japanese Typography Chapters
Each of the following sections will contain the following to help you utilize and extend the
Japanese typography features in InDesign: CS-J
•
Background information and usage scenarios
•
Class diagrams
•
Navigation diagrams, including brief interface descriptions
•
Commands and notification
•
Working with each typography feature area
•
Further references and samples in the SDK
Japanese Feature Additions for InDesign
43
Japanese Feature Additions for InDesign
Japanese Typography: Japanese Text Composers
Further References
The following chapters in the Programming Guide provide the necessary background
information necessary to fully understand the remaining sections on Japanese Features:
•
Text Attributes
•
Text Adornments
•
Text Layout
•
The Wax
•
Text Composition
•
Working with Text Styles
Japanese Typography: Japanese Text Composers
Background information and descriptions of usage scenarios
The complex nature of Japanese typesetting have resulted in an enormous expansion of text
attributes, adornments and mojikumi rules in the InDesign text model. These additional text
composition properties require the use of a Japanese text composer for proper composition.
You may have noticed that in the Japanese version of InDesign CS, you can pick one of the four
text composers from the Paragraph panel:
•
Adobe Single-line Composer
•
Adobe Paragraph Composer
•
Adobe Japanese Single-line Composer
•
Adobe Japanese Paragraph Composer
All four text composers are available at all times regardless of the feature set. This enables one
to open a document with text composed using InDesign CS-J, under InDesign CS.
Furthermore, if you are automating your workflow on InDesign CS, and if your workflow
happens to include Japanese text and text attributes, you can programmatically switch the text
composer on a text paragraph to use one of the Japanese composers.
This section briefly describes the two Japanese text composers that are available in all locales of
InDesign CS, and some tips on working with them.
Class Diagram
There are two Japanese-specific text composers in InDesign CS and InDesign CS-J. (The boss
class diagrams have been omitted since they are nearly identical.)
44
Japanese Feature Additions for InDesign
Japanese Typography: Japanese Text Composers
kJParagraphComposerBoss
•
IK2ServiceProvider: Identifies this boss as service provider (kTextEngineService) and
provides the name of the composer via the service provider name.
•
IParagraphComposer: Provides the actual text composer implementation for this boss,
the Adobe Japanese Paragraph Composer.
kJSingleComposerBoss
•
IK2ServiceProvider: Identifies this boss as service provider (kTextEngineService) and
provides the name of the composer via the service provider name.
•
IParagraphComposer: Provides the actual text composer implementation for this boss,
the Adobe Japanese Single-Line Composer.
In addition, the kTextAttrComposerBoss is the text attribute boss that keeps the composer class
ID for the corresponding paragraph in the text story.
Navigation Diagram
Here are some descriptions of bridge methods that show how to navigate from some textrelated boss to a composer boss.
Japanese Feature Additions for InDesign
45
Japanese Feature Additions for InDesign
Japanese Typography: Japanese Text Composers
FIGURE 1.7
Simplified Navigation Diagram for the Text Composer Model
IComposeScanner:QueryAttributeAt(kTextAttrComposerBoss)
1
IComposeScanner
(IItemStrand *)ITextModel:QueryStrand(kOwnedItemStrandBoss)
Describes an
ILG.
1
1
<<boss class>>
kTextStoryBoss
ITextModel
IItemStrand
11
(IWaxStrand *)ITextModel:QueryStrand(kFrameListBoss)
ITextModel::QueryFrameList
1
IFrameList
1
<<boss class>>
kOwnedItemStrandBoss
1
1
<<boss class>>
kFrameListBoss
IItemStrand::GetNthOwnedUID
IWaxStrand
1
<<boss class>>
kInlineBoss
1
IOwnedItem
IWaxStrand::QueryComposer
1
IAttrReport
1
<<boss class>>
k*ComposerBoss
1
1 IOwnedItem::QueryComposer
IParagraphComposer
IK2ServiceProvider
<<boss class>>
kTextAttrComposerBoss
ITextAttrClassID::Get
ITextAttrClassID
The scope here is
limited to inline graphics.
You can also use
ITextUtils::
CollectOwnedItems()
and iterate the
OwnedItemDataList.
1
Commands and Notification
For details on composer related commands and notification, refer to the Text and Text
Composer chapters in the Programming Guide.
Working with Japanese Text Composers
How to set the composer for a paragraph
This is a useful technique when you are automatically composing text in your plug-in, and you
want to take advantage of Japanese text attributes. To set the composer for a specific part of the
text model, use the ITextModelCmds::ApplyCmd() to generate a attribute applying
command on the kParaAttrStrandBoss (since composers are paragraph attributes):
ITextModel* textModel = ...; // assumed to be previously
obtained
TextIndex start = ...; // specify the starting text index
int32 length = ...; // specify length
AttributeBossList* list= new AttributeBossList;
ClassID composerClass = kJParagraphComposerBoss; // for
example...
46
Japanese Feature Additions for InDesign
Japanese Typography: Japanese Text Composers
InterfacePtr<ITextAttrClassID>
composerAttr(::CreateObject2<ITextAttrClassID>(kTextAttrCom
poserBoss));
composerAttr->Set(composerClass);
list->ApplyAttribute(composerAttr);
InterfacePtr<ITextModelCmds> textModelCmds(textModel,
UseDefaultIID());
InterfacePtr<ICommand> applyCmd(textModelCmds>ApplyCmd(start, length, list, kParaAttrStrandBoss));
ErrorCode status = CmdUtils::ProcessCommand(applyCmd);
If you are applying to the currently selected text range using the ITextAttributeSuite
interface inside your own concrete selection boss (CSB) implementation, you can simply call
ITextAttributeSuite::ApplyAttribute() with the IPMUnknown parameter set
to the ITextAttrClassID interface, as shown above. (For details on the Selection
architecture, refer to the Selection technote.)
How to find out which composer is used for a specific paragraph
If you know which text model (ITextModel) you want to examine, query for the
IComposeScanner interface on the same boss (kTextStoryBoss), and call
QueryAttributeAt() to get the text attribute boss as such:
TextIndex start = ..., end = ...; // set appropriately
InterfacePtr<IAttrReport>
attrReport(composeScanner->
QueryAttributeAt(start, end,
kTextAttrComposerBoss));
InterfacePtr<ITextAttrClassID>
textAttrClassID(attrReport, UseDefaultIID());
ClassID composerClass = textAttrClassID->Get();
You now have the composer class ID.
Alternatively, if you have a text focus (ITextFocus), you can query for the IFocusCache
interface, which caches attributes for quick access, and call
IFocusCache::QueryAttributeN() to obtain the ITextAttrClassID interface on the
kTextAttrComposerBoss.
Idiosyncrasies
What happens when you have Japanese text attributes on a paragraph composed
with a Roman composer?
Let’s consider how a story that contains Japanese text features would compose without the use
of a Japanese composer. Here is a sample text story composed with the Adobe Roman Singleline Composer.
Japanese Feature Additions for InDesign
47
Japanese Feature Additions for InDesign
Japanese Typography: Japanese Text Composers
FIGURE 1.8
Improperly composed Japanese text, using the Adobe Roman Single-Line Composer
The most obvious difference is that the story that was composed vertically with the Japanese
single-line composer isn’t composed vertically at all with the Roman single-line composer; the
characters are rotated clockwise by 90 degrees. (This is due to the fact that a vertical text frame
is a 90-degree clockwise rotation of a horizontal text frame. That is, the X-coordinates increase
in the downward direction, and the Y-coordinates increase to the right of the page.) Another
difference is that most of the Japanese text features (e.g. tate-chu-yoko (text feature 3 from
screen shot of properly composed Japanese text), ruby (text feature 5), kenten (text feature 6))
don’t receive any special composition treatment. Mojikumi rules (like the first character
indentation) and kinsoku rules (like burasagari, gyoutou kinsoku moji) are also ignored (e.g.
the hanging comma (text feature 1) and the Japanese period on the left most line). The dotted
underline also appears on the other side of the characters; it appears to the right of the
characters in the case of the Japanese single-line composer, but to the left, or underneath the
characters in the case of the Roman single-line composer (#1 in blue from screen shot of
improperly composed text). Another subtle difference is in how the text selection highlighting
works. Note that in the story composed with the Japanese single-line composer, the highlighted
area overlaps the grid boxes (in the size of the kasou body) perfectly. However, in the story
composed with the Roman single-line composer, the highlighted area is a little wider than the
kasou body, since it there are some differences in wax line metrics. These are just a few of the
reasons why we recommend that you compose Japanese text using one of the Japanese
paragraph composers.
References and Samples
There are no samples in the SDK that show you how to set and get a composer for a specific
part of the text model, however, the previous topics should help in that regard.
There are samples in the SDK that show you how to create a custom composer:
48
Japanese Feature Additions for InDesign
Japanese Typography: General Mojikumi features
•
SingleLineComposer: Implementation of a single-line composer.
•
ComposerJ: Implementation of a single-line composer that takes several Japanese text
attributes into consideration.
Please note that the development of a constructor requires detailed knowledge of the text
layout and wax architecture and should be performed with careful engineering.
Japanese Typography: General Mojikumi features
Background information and descriptions of usage scenarios
As explained in a previous section, Japanese typesetting is accomplished by a set of Japanesespecific paragraph composer implementations. These composers rely on an intricate set of
mojikumi rules, which determine character spacing (kerning and width), and kinsoku rules,
which determine line breaks. This section explores the set of mojikumi and kinsoku rules.
Class Diagram
Style name tables (IStyleNameTable) for mojikumi and kinsoku are aggregated in the
kDocWorkspaceBoss and kWorkspaceBoss.
•
IID_IMOJIKUMINAMETABLE: Stores a list of highly intricate mojikumi tables, which
associates a class of characters and how much space (in embox units) they should occupy
when placed before and after specific classes of characters. Each entry in this table is
associated also with a mojikumi character class list and a tsume list. (See below)
•
IID_IKINSOKUNAMETABLE: Stores a list of kinsoku (line breaking) rules, in which
characters (by UNICODE values) are placed into one of 4 categories: KinsokuBefore
(characters which cannot have line breaks before them), KinsokuAfter (characters which
cannot have line breaks after them), KinsokuHanging (characters which can hang outside
of a text frame if it comes at the end of a line), and KinsokuNotSeparate (characters
which cannot be separated at the end of a line).
Japanese Feature Additions for InDesign
49
Japanese Feature Additions for InDesign
Japanese Typography: General Mojikumi features
In the InDesign UI, the current mojikumi and kinsoku rules sets show up as named styles at
the bottom of the paragraph panel.
Each of the name table entries point to one of the following persistent bosses. In each type of
table entry, the IStringData interface on these bosses store the name of the table entry.
50
•
Mojikumi name table entries refer to bosses that aggregate IMojikumiTable.
•
kHardcodedMojikumiStyleBoss: Application-provided default set of mojikumi rules.
Tthere are 15 different instances of this boss, each one signifying a different set of
mojikumi rules. (The enums are listed in
{SDK}/public/interfaces/cjk/IMojikumiTable.h – look for the enum
kDefaultMojikumiSet_None.)
•
kMojikumiStyleBoss: For user-created mojikumi rules.
•
Mojikumi Character Class List table entries refer to bosses that aggregate
IMojikumiChararacterClassList (see
{SDK}/public/interfaces/cjk/IMojikumiChararacterClassList.h
).
•
kDefaultMojikumiCharacterClassListBoss: Application-provided default set of mojikumi
characters.
•
kMojikumiClassListStyleBoss: For user-created mojikumi character classes. However,
there is no UI panel available in InDesign CS-J to create a custom mojikumi class list, so
you can only create one using a command.
Japanese Feature Additions for InDesign
Japanese Typography: General Mojikumi features
•
Tsume name table entries refer to bosses that aggregate ITsumeTable (see
{SDK}/public/interfaces/cjk/ITsumeTable.h).
•
kHardcodedTsumeBoss: For the hardcoded set of tsume rules. (One of the applicationprovided default set of tsume settings.)
•
kHardcodedTsumeNoneBoss: For "no" tsume rules. (One of the application-provided
default set of tsume settings.)
•
kTsumeStyleBoss: For user-created tsume settings. However, there is no UI panel
available in InDesign CS-J to create a custom tsume setting table, so you can only create
one using a command.
•
Kinsoku name table entries refer to bosses that aggregate IKinsokuTable (see
{SDK}/public/interfaces/cjk/IKinsokuTable.h)
•
kHardcodedKinsokuHardBoss: For "hard" kinsoku rules. (One of the applicationprovided default kinsoku rules.)
•
kHardcodedKinsokuSoftBoss: For "soft" kinsoku rules. (One of the application-provided
default kinsoku rules.)
•
kHardcodedKinsokuNoneBoss: For no kinsoku rules. (One of the application-provided
default kinsoku rules.)
•
kKinsokuStyleBoss: For user-created kinsoku rules.
Some of the mojikumi and kinsoku settings are made accessible in a read-only fashion from
the IMojikumiStyle interface on kComposeStyleBoss, which aids the composer. For more
details, see Japanese-specific additions into kComposeStyleBoss.
Japanese Feature Additions for InDesign
51
Japanese Feature Additions for InDesign
Japanese Typography: General Mojikumi features
Navigation Diagram
FIGURE 1.9
Navigation Diagram for the Mojikumi Model
<<boss class>>
Mojikumi CharClassList Boss
IMojikumiCharClassList
IStringData
1..*
IStyleNameTable::Get...()
1
IStyleNameTable (IID_IMOJIKUMICHARCLASSLISTNAMETABLE)
<<boss class>>
k*WorkspaceBoss
IStyleNameTable (IID_ITSUMENAMETABLE)
IStyleNameTable (IID_IMOJIKUMINAMETABLE)
IStyleNameTable::Get...()
1
1..*
IStyleNameTable (IID_IKINSOKUNAMETABLE)
IStyleNameTable::Get...()1
1..*
<<boss class>>
Tsume Boss
ITsumeTable 1
IStringData
IStyleNameTable::Get...()
<<boss class>>
Mojikumi Boss
IMojikumiTable
IStringData
1..*
<<boss class>>
Kinsoku Boss
IKinsokuTable
IStringData
In order to query a specific style name table in a workspace boss, you must specify it by a
specific IID.
InterfacePtr<IWorkspace>
workSpace(Utils<ILayoutUtils>()->QueryActiveWorkspace());
InterfacePtr<IStyleNameTable>
kinsokuNameTable(workSpace, IID_IKINSOKUNAMETABLE);
Refer to IStyleNameTable for bridge methods that navigate from a workspace boss to a
name table entry boss.
Commands and Notification
The following are mojikumi table related commands:
•
kCreateMojikumiTableCmdBoss
•
kDeleteMojikumiTableCmdBoss
•
kLoadMojikumiTableCmdBoss
•
kReplaceMojikumiTableCmdBoss
•
kEditMojikumiTableCmdBoss
•
kCopyMojikumiCmdBoss
The following are kinsoku table related commands:
52
Japanese Feature Additions for InDesign
Japanese Typography: General Mojikumi features
•
kCreateKinsokuTableCmdBoss
•
kDeleteKinsokuTableCmdBoss
•
kReplaceKinsokuTableCmdBoss
TABLE 1.19 kCreateMojikumiTableCmdBoss
Purpose:
Creates a new mojikumi table and adds it to the name style table
(IID_IMOJIKUMINAMETABLE)
Also calls:
None
Interfaces:
•
•
IUIDData: (Optional) The UID of an existing mojikumi table on which to base
this new one. If this contains a value other than kInvalidUID, the contents of the
specified mojikumi table are copied into this new one.
IStringData: (Optional) Name of the new mojikumi table. (If setting a translatable
string, make sure the translations are available in your plug-in at least for the
Japanese UI locale.) If left blank, the default name given is “Duplicate Mojikumi”
(which has no translation).
ItemList Input:
UID of the workspace boss that contains the mojikumi name style table.
Observer Notification:
theChange = kCreateMojikumiTableCmdBoss, protocol =
IID_IMOJIKUMINAMETABLE. Subjects for the items on the item list are notified.
ItemList Output:
Not applicable. To obtain the newly created mojikumi table, look for the last entry on the
mojikumi name table immediately after processing this command.
Command usage sample:
None.
TABLE 1.20 kDeleteMojikumiTableCmdBoss
Purpose:
Deletes an existing mojikumi table, removes it from the style name table
(IID_IMOJIKUMINAMETABLE) and walks all text stories and workspace defaults to
replace instances of the specified mojikumi table with the default mojikumi table.
Also calls:
kApplyTextAttrToWorkspaceCmdBoss, kEditTextStyleCmdBoss,
kClearTextAttrCmdBoss, kDeleteUIDsCmdBoss
Interfaces:
•
ItemList Input:
UID of the workspace boss that contains the mojikumi name style table.
Observer Notification:
theChange = kDeleteMojikumiTableCmdBoss, protocol =
IID_IMOJIKUMINAMETABLE. Subjects for the items on the item list are notified.
ItemList Output:
Not applicable.
Command usage sample:
None.
IUIDData: (Required) The UID of an existing mojikumi table to delete. You must
not delete any of the application-provided default mojikumi tables. (You will get
an assert in the debug build)
Japanese Feature Additions for InDesign
53
Japanese Feature Additions for InDesign
Japanese Typography: General Mojikumi features
TABLE 1.21 kLoadMojikumiTableCmdBoss
Purpose:
Loads a mojikumi table from another InDesign document.
Also calls:
kOpenDocCmdBoss if the specified document is not already open. Also calls
kReplaceMojikumiTableCmdBoss or kReplaceKinsokuTableCmdBoss depending on the
IIntData setting. (See enums in ILoadStyleCmdData)
Interfaces:
•
•
ISysFileData: (Required) The SysFile of the InDesign document from which you
want to load a mojikumi table.
IIntData: (Required) Set it to ILoadStyleCmdData::kLoadTsumeTable or
ILoadStyleCmdData::kLoadKinsokuTable.
ILoadStyleCmdData::kLoadMojikumiTable is also available, but it does the same
thing as setting this IIntData interface to ILoadStyleCmdData::kLoadTsumeTable.
ItemList Input:
UID of the workspace boss that contains the mojikumi name style table you want to load
into.
Observer Notification:
None.
ItemList Output:
Not applicable.
Command usage sample:
None.
TABLE 1.22 kReplaceMojikumiTableCmdBoss
Purpose:
Replaces a mojikumi table entry in one workspace with an entry in another workspace.
(Generally across two documents)
Also calls:
None.
Interfaces:
•
ItemList Input:
Ignored.
Observer Notification:
None.
ItemList Output:
Not applicable.
Command usage sample:
None.
ILoadStyleCmdData: (Required) Specify the style name tables in the source and
destination workspaces, and the UIDs of the source and destination mojikumi
tables. Both of the UIDs must refer to a persistent boss that aggregates
IMojikumiTable in the correct style name table.
TABLE 1.23 kEditMojikumiTableCmdBoss
54
Purpose:
Edits an existing mojikumi table.
Also calls:
None.
Japanese Feature Additions for InDesign
Japanese Typography: General Mojikumi features
Interfaces:
•
IEditMojikumiTableCmdData: (Required) Specify the following data for the
command:
•
SetTargetUID() : UID of the mojikumi table to edit. If the target mojikumi table is
not editable (IMojikumiTable::GetEditability()), this command does nothing.
AddEditData(): Call this for each setting you want to override in the mojikumi
table. Refer to MojikumiOverrideSpacing in
{SDK}/public/interfaces/cjk/IMojikumiTable.h for details.
SetComposeFlag(): Set composeFlag to kTrue if you want to recompose all stories
on the same database as the target mojikumi table after this edit. (For example, if
the mojikumi table is referred to from kDocWorkspaceBoss, all stories on the same
document will be recomposed.
•
•
ItemList Input:
UID of the destination workspace boss that contains the mojikumi name style table you
want to edit.
Observer Notification:
None.
ItemList Output:
Not applicable.
Command usage sample:
None.
TABLE 1.24 kCopyMojikumiCmdBoss
Purpose:
A general purpose command that copies mojikumi, tsume and kinsoku tables.
Also calls:
None.
Interfaces:
•
•
ItemList Input:
UID of the destination workspace boss that contains the style name table you want to
copy into.
Observer Notification:
theChange = kCopyMojikumiCmdBoss, protocol = IID you passed into IIntData. The
subject on the workspace in the item list is used for the notification.
ItemList Output:
The UID of the target table.
Command usage sample:
None.
IUIDData: (Required) The UID of the source table.
IIntData: (Required) The IID of the style name table you want to copy to.
TABLE 1.25 kCreateKinsokuTableCmdBoss
Purpose:
Creates a new kinsoku table and adds it to the name style table
(IID_IKINSOKUNAMETABLE)
Also calls:
None
Japanese Feature Additions for InDesign
55
Japanese Feature Additions for InDesign
Japanese Typography: General Mojikumi features
Interfaces:
•
•
IUIDData: (Optional) The UID of an existing kinsoku table on which to base this
new one. If this contains a value other than kInvalidUID, the contents of the
specified kinsoku table are copied into this new one.
IStringData: (Optional) Name of the new kinsoku table. (If setting a translatable
string, make sure the translations are available in your plug-in at least for the
Japanese UI locale.) If left blank, the default name given is “Duplicate Kinsoku”
(which has no translation).
ItemList Input:
UID of the workspace boss that contains the kinsoku name style table.
Observer Notification:
theChange = kCreateKinsokuTableCmdBoss, protocol = IID_IKINSOKUNAMETABLE.
Subjects for the items on the item list are notified.
ItemList Output:
Not applicable. To obtain the newly created kinsoku table, look for the last entry on the
kinsoku name table immediately after processing this command.
Command usage sample:
SnpPerformKinsokuTable.cpp (SnippetRunner sample plug-in)
TABLE 1.26 kDeleteKinsokuTableCmdBoss
Purpose:
Deletes an existing kinsoku table, removes it from the style name table
(IID_IKINSOKUNAMETABLE) and walks all text stories, workspace defaults, and
paragraph styles to replace instances of the specified kinsoku table with the default
kinsoku table.
Also calls:
kApplyTextAttrToWorkspaceCmdBoss, kEditTextStyleCmdBoss,
kClearTextAttrCmdBoss, kDeleteUIDsCmdBoss
Interfaces:
•
ItemList Input:
UID of the workspace boss that contains the kinsoku name style table.
Observer Notification:
theChange = kDeleteKinsokuTableCmdBoss, protocol = IID_IKINSOKUNAMETABLE.
Subjects for the items on the item list are notified.
ItemList Output:
Not applicable.
Command usage sample:
SnpPerformKinsokuTable.cpp (SnippetRunner sample plug-in)
IUIDData: (Required) The UID of an existing kinsoku table to delete. You must
not delete any of the application-provided default kinsoku tables. (You will get an
assert in the debug build)
TABLE 1.27 kReplaceKinsokuTableCmdBoss
56
Purpose:
Replaces a kinsoku table entry in one workspace with an entry in another workspace.
(Generally across two documents)
Also calls:
None.
Interfaces:
•
ILoadStyleCmdData: (Required) Specify the style name tables in the source and
destination workspaces, and the UIDs of the source and destination kinsoku
tables. Both of the UIDs must refer to a persistent boss that aggregates
IKinsokuTable in the correct style name table.
Japanese Feature Additions for InDesign
Japanese Typography: General Mojikumi features
ItemList Input:
Ignored.
Observer Notification:
None.
ItemList Output:
Not applicable.
Command usage sample:
None.
Working with Mojikumi Features
How to create a named table entry for mojikumi, and kinsoku
To create a named table entry for mojikumi and kinsoku tables, process the
kCreateMojikumiTableCmdBoss or kCreateKinsokuTableCmdBoss, respectively.
How to get named table entry and details (mojikumi, tsume, kinsoku)
To get named table entries for mojikumi, tsume, and kinsoku, first query the
IStyleNameTable interface on a specific workspace (kDocWorkspaceBoss or
kWorkspaceBoss) using the specific IID (IID_IMOJIKUMINAMETABLE,
IID_ITSUMENAMETABLE, IID_IKINSOKUNAMETABLE), then get the UID of a specific
entry so you can query for the IMojikumiTable, ITsumeTable, or IKinsokuTable
interface of that persistent boss. Then use the Get methods on the IMojikumiTable,
ITsumeTable, or IKinsokuTable interfaces to get data about the specific entries.
For example, to get the kinsoku table named “MyKinsokuTable” in a document: (Error
checking omitted for brevity)
IDocument* doc = ...; // previously obtained
UIDRef wsRef = doc-> GetDocWorkSpace (); // aggregates
IWorkspace
InterfacePtr<IStyleNameTable>
kinsokuNameTable(wsRef, IID_IKINSOKUNAMETABLE);
PMString tableName = "MyKinsokuTable";
const UID kinsokuTableUID =
kinsokuNameTable->FindByName(tableName);
InterfacePtr<IKinsokuTable>
kinsokuTable(wsRef.GetDataBase(), kinsokuTableUID,
UseDefaultIID());
Setting the mojikumi, kinsoku, or tsume table to use in a paragraph or a specific
character
Each of these tables can be specified on a portion of a text story as a standard text attribute.
Mojikumi tables and kinsoku tables are specified as paragraph attributes
(kTAMojikumiTableBoss and kTAKinsokuTableBoss, respectively), and tsume tables are
specified as character attributes. (kTATsumeTableBoss). Each of these attribute bosses
aggregate ITextAttrUID, which can be set to the UID of the specific name table entry. For
more details, refer to the next section regarding text attributes and adornments.
Japanese Feature Additions for InDesign
57
Japanese Feature Additions for InDesign
Japanese Typography: Japanese-Specific Text Attributes and Adornments
NOTE: Tsume tables are no longer used so even if you apply the attribute, the composition is
not affected.
References and Samples
Refer to the SnpPerformKinsokuTable.cpp snippet (SnippetRunner plug-in) for an example on
how to manipulate kinsoku tables.
Japanese Typography: Japanese-Specific Text Attributes and
Adornments
Background information and descriptions of usage scenarios
As explained in a previous section, Japanese typesetting is accomplished by a set of Japanesespecific paragraph composer implementations. In addition to typesetting rules, these
composers rely on a vast number of text attributes and adornments, which determine how each
character is to be drawn. This section explores the set of text attributes and adornments
supported solely by the Japanese text composers.
Class Diagram
Japanese-specific text attributes and text adornments
Text attributes aggregate the IAttrReport interface. The boss names of Japanese-specific
text attributes generally begin with “kTA”, however, there are a few exceptions. Text
adornments aggregate the ITextAdornment interface, and optionally aggregate the
ITextAdornmentData. Refer to the table of text attributes and adornments below for a list
of Japanese-specific text attributes.
Japanese-specific text attributes.
58
Category
AttributeBoss
Description
Para/
Char
ITextAttr* Interface
IME
kTAIMECompModeBoss
[none]
Charact
er
ITextAttrCompMod
e
Kenten
kTAKentenAlignmentBoss
+ Kenten Alignment: Center
Charact
er
ITextAttrInt16
Kenten
kTAKentenCharacterBoss
+ Kenten Character:
Charact
er
ITextAttrInt16
Kenten
kTAKentenCharacterSetBoss
[none]
Charact
er
ITextAttrInt16
Japanese Feature Additions for InDesign
Japanese Typography: Japanese-Specific Text Attributes and Adornments
Category
AttributeBoss
Description
Para/
Char
ITextAttr* Interface
Kenten
kTAKentenColorBoss
+ Kenten Color: Auto
Charact
er
ITextAttrUID
Kenten
kTAKentenFontFamilyBoss
+ Kenten Font:
Charact
er
ITextAttrUID
Kenten
kTAKentenFontStyleBoss
[none]
Charact
er
ITextAttrFont
Kenten
kTAKentenKindBoss
+ Kenten Kind: None
Charact
er
ITextAttrInt16
Kenten
kTAKentenOutlineBoss
+ Kenten Outline: Auto
Charact
er
ITextAttrRealNumbe
r
Kenten
kTAKentenOverprintBoss
Kenten OverprintAuto
Charact
er
ITextAttrInt16
Kenten
kTAKentenPositionBoss
+ Kenten Position: Above/Right
Charact
er
ITextAttrBoolean
Kenten
kTAKentenRelatedSizeBoss
+ Kenten Related Size: 1 pt
Charact
er
ITextAttrRealNumbe
r
Kenten
kTAKentenSizeBoss
+ Kenten Size: Auto
Charact
er
ITextAttrRealNumbe
r
Kenten
kTAKentenStrokeColorBoss
+ Kenten Stroke Color: Auto
Charact
er
ITextAttrUID
Kenten
kTAKentenStrokeOverprintBoss
Kenten Stroke OverprintAuto
Charact
er
ITextAttrInt16
Kenten
kTAKentenStrokeTintBoss
+ Kenten Stroke Tint: Auto
Charact
er
ITextAttrRealNumbe
r
Kenten
kTAKentenTintBoss
+ Kenten Tint: Auto
Charact
er
ITextAttrRealNumbe
r
Kenten
kTAKentenXScaleBoss
+ Kenten X Scale: 100%
Charact
er
ITextAttrRealNumbe
r
Kenten
kTAKentenYOffsetBoss
+ Kenten Placement: 0 pt
Charact
er
ITextAttrRealNumbe
r
Kenten
kTAKentenYScaleBoss
+ Kenten Y Scale: 100%
Charact
er
ITextAttrRealNumbe
r
Kinsoku
kTAKinsokuTableBoss
+ Kinsoku: No Kinsoku
Paragra
ph
ITextAttrUID
Kinsoku
kTAKinsokuTypeBoss
+ Kinsoku Type:
KinsokuPushInFirst
Paragra
ph
ITextAttrKinsokuTy
pe
Japanese Feature Additions for InDesign
59
Japanese Feature Additions for InDesign
Japanese Typography: Japanese-Specific Text Attributes and Adornments
60
Category
AttributeBoss
Description
Para/
Char
ITextAttr* Interface
Miscellane
ous
kTACharRotateAngleReportBos
s
+ Character Rotation: 0 ー
Charact
er
ITextAttrRealNumbe
r
Miscellane
ous
kTAIndexMarkBoss
- Index Marker
Charact
er
ITextAttrBoolean
Miscellane
ous
kTAScaleAffectsLineHeightBoss
- Adjust Line Height with Char Scale
Charact
er
ITextAttrBoolean
Miscellane
ous
kTextAttrGlyphFormBoss
+ Glyph Form: Default form
Charact
er
ITextAttrGlyphForm
Miscellane
ous
kTextAttrOTFeatureListBoss
+ OTF Feature:
Charact
er
ITextAttrOTFeature
List
Mojikumi
kTABunriKinshiBoss
+ Bunri-Kinshi
Paragra
ph
ITextAttrBoolean
Mojikumi
kTACJKGridTrackingBoss
- Adjust Tracking with CJK Grid
Charact
er
ITextAttrBoolean
Mojikumi
kTACJKHangingBoss
+ Hang Type: KinsokuNoHang
Paragra
ph
ITextAttrKinsokuHa
ngType
Mojikumi
kTAGridAlignOnlyFirstLineRep
ortBoss
- Only Align First Line To Grid
Paragra
ph
ITextAttrBoolean
Mojikumi
kTAGridGyoudoriReportBoss
+ Grid Gyoudori: 0
Paragra
ph
ITextAttrInt16
Mojikumi
kTAGridJidoriReportBoss
+ Jidori: 0
Charact
er
ITextAttrInt16
Mojikumi
kTAKumiNumberReportBoss
+ Kumi Number: 0
Paragra
ph
ITextAttrInt16
Mojikumi
kTAKumiNumberWithRomanR
eportBoss
- Kumi Number with Roman
Paragra
ph
ITextAttrBoolean
Mojikumi
kTALeadingModelBoss
+ Leading Model: Aki Below
Paragra
ph
ITextAttrLeadingMo
del
Mojikumi
kTAMojikumiAdjustPeriodBoss
[none]
Paragra
ph
ITextAttrBoolean
Mojikumi
kTAMojikumiForceAfterSpacing
Boss
+ Aki after char: automatic
Charact
er
ITextAttrRealNumbe
r
Mojikumi
kTAMojikumiForceBeforeSpaci
ngBoss
+ Aki before char: automatic
Charact
er
ITextAttrRealNumbe
r
Mojikumi
kTAMojikumiFullAdjustBoss
[none]
Paragra
ph
ITextAttrBoolean
Japanese Feature Additions for InDesign
Japanese Typography: Japanese-Specific Text Attributes and Adornments
Category
AttributeBoss
Description
Para/
Char
ITextAttr* Interface
Mojikumi
kTAMojikumiRensuujiBoss
+ Rensuuji
Paragra
ph
ITextAttrBoolean
Mojikumi
kTAMojikumiRomanWidthBoss
[none]
Paragra
ph
ITextAttrBoolean
Mojikumi
kTAMojikumiTableBoss
+ Mojikumi:
Paragra
ph
ITextAttrUID
Mojikumi
kTAParaGyoudoriBoss
- Paragraph Gyoudori:
Paragra
ph
ITextAttrBoolean
Mojikumi
kTARotateRomanBoss
- Rotate Roman
Paragra
ph
ITextAttrBoolean
Mojikumi
kTextAttrGridAlignmentBoss
+ Grid Alignment: None
Paragra
ph
ITextAttrGridAlign
ment
OpenType
kTAOTFHVKanaBoss
- OTF Use H or V Kana
Charact
er
ITextAttrBoolean
OpenType
kTAOTFProportionalBoss
- OTF Use Proportional Metrics
Charact
er
ITextAttrBoolean
OpenType
kTAOTFRomanItalicsBoss
- OTF Use Roman Italics
Charact
er
ITextAttrBoolean
Ruby
kTAMojiRubyBoss
+ Ruby Type: Per-Character Ruby
Charact
er
ITextAttrBoolean
Ruby
kTARubyAdjustParentBoss
+ Spacing:1-2-1 aki
Charact
er
ITextAttrRubyAdjust
Parent
Ruby
kTARubyAlignmentBoss
+ Ruby Alignment: 1-2-1 (JIS) rule
Charact
er
ITextAttrRubyAlign
Ruby
kTARubyAttrBoss
[none]
Charact
er
ITextAttrBoolean
Ruby
kTARubyAutoScaleMinBoss
+ Ruby AutoScale Min: 66%
Charact
er
ITextAttrRealNumbe
r
Ruby
kTARubyAutoScalingBoss
- Ruby Auto Scaling
Charact
er
ITextAttrBoolean
Ruby
kTARubyColorBoss
+ Ruby Color: Auto
Charact
er
ITextAttrUID
Ruby
kTARubyEdgeSpaceBoss
+ Ruby Auto Align
Charact
er
ITextAttrBoolean
Ruby
kTARubyFontStyleBoss
[none]
Charact
er
ITextAttrFont
Japanese Feature Additions for InDesign
61
Japanese Feature Additions for InDesign
Japanese Typography: Japanese-Specific Text Attributes and Adornments
62
Category
AttributeBoss
Description
Para/
Char
ITextAttr* Interface
Ruby
kTARubyFontUIDBoss
+ Ruby Font:
Charact
er
ITextAttrUID
Ruby
kTARubyOTProBoss
+ Ruby Open Type Pro
Charact
er
ITextAttrBoolean
Ruby
kTARubyOutlineBoss
+ Ruby Outline: Auto
Charact
er
ITextAttrRealNumbe
r
Ruby
kTARubyOverhangBoss
+ Ruby Overhang: Up to 1 Ruby
Character
Charact
er
ITextAttrRubyOverh
ang
Ruby
kTARubyOverhangFlagBoss
- Ruby Overhang
Charact
er
ITextAttrBoolean
Ruby
kTARubyOverprintBoss
+ Ruby Fill OverprintAuto
Charact
er
ITextAttrInt16
Ruby
kTARubyPointSizeBoss
+ Ruby Point Size: Auto
Charact
er
ITextAttrRealNumbe
r
Ruby
kTARubyPositionBoss
+ Ruby Position: Above/Right
Charact
er
ITextAttrBoolean
Ruby
kTARubyRelativeSizeBoss
[none]
Charact
er
ITextAttrRealNumbe
r
Ruby
kTARubyStringBoss
[none]
Charact
er
ITextAttrWideString
Ruby
kTARubyStrokeColorBoss
+ Ruby Stroke Color: Auto
Charact
er
ITextAttrUID
Ruby
kTARubyStrokeOverprintBoss
+ Ruby Stroke OverprintAuto
Charact
er
ITextAttrInt16
Ruby
kTARubyStrokeTintBoss
+ Ruby Stroke Tint: Auto
Charact
er
ITextAttrRealNumbe
r
Ruby
kTARubyTintBoss
+ Ruby Tint: Auto
Charact
er
ITextAttrRealNumbe
r
Ruby
kTARubyXOffsetBoss
+ Ruby X Offset: 0 pt
Charact
er
ITextAttrRealNumbe
r
Ruby
kTARubyXScaleBoss
+ Ruby X Scale: 100%
Charact
er
ITextAttrRealNumbe
r
Ruby
kTARubyYOffsetBoss
+ Ruby Y Offset: 0 pt
Charact
er
ITextAttrRealNumbe
r
Ruby
kTARubyYScaleBoss
+ Ruby Y Scale: 100%
Charact
er
ITextAttrRealNumbe
r
Japanese Feature Additions for InDesign
Japanese Typography: Japanese-Specific Text Attributes and Adornments
Category
AttributeBoss
Description
Para/
Char
ITextAttr* Interface
Shatai
kTAShataiAdjustRotationBoss
- Shatai Adjust Rotation
Charact
er
ITextAttrBoolean
Shatai
kTAShataiAdjustTsumeBoss
+ Shatai Adjust Tsume
Charact
er
ITextAttrBoolean
Shatai
kTAShataiAngleBoss
+ Shatai Angle: 45 ー
Charact
er
ITextAttrRealNumbe
r
Shatai
kTAShataiMagnificationBoss
+ Shatai Percentage: 0%
Charact
er
ITextAttrRealNumbe
r
Tatechuyo
ko
kTATatechuyokoAttrBoss
- Tatechuyoko
Charact
er
ITextAttrBoolean
Tatechuyo
ko
kTATatechuyokoXOffsetBoss
+ Tatechuyoko X Offset: 0 pt
Charact
er
ITextAttrRealNumbe
r
Tatechuyo
ko
kTATatechuyokoYOffsetBoss
+ Tatechuyoko Y Offset: 0 pt
Charact
er
ITextAttrRealNumbe
r
Tsume
kTATsumeTableBoss
[none]
Charact
er
ITextAttrUID
Tsume
(obsolete)
kTATsumeBoss
+ Tsume: 0%
Charact
er
ITextAttrRealNumbe
r
Warichu
kTAWarichuAlignmentBoss
+ Warichu:AlignAuto
Charact
er
ITextAttrAlign
Warichu
kTAWarichuAttrBoss
- Warichu
Charact
er
ITextAttrBoolean
Warichu
kTAWarichuAutoResizeParenBo
ss
+
Charact
er
ITextAttrBoolean
Warichu
kTAWarichuLineSpacingBoss
+ Warichu line gap: 0 pt
Charact
er
ITextAttrRealNumbe
r
Warichu
kTAWarichuMinCharsAfterBrea
kBoss
+ Warichu minimum characters
after: 2
Charact
er
ITextAttrInt16
Warichu
kTAWarichuMinCharsBeforeBre
akBoss
+ Warichu minimum characters
before: 2
Charact
er
ITextAttrInt16
Warichu
kTAWarichuNumOfLineBoss
+ Warichu lines: 2
Charact
er
ITextAttrInt16
Warichu
kTAWarichuRelativeSizeBoss
+ Warichu size: 50%
Charact
er
ITextAttrRealNumbe
r
Japanese Feature Additions for InDesign
63
Japanese Feature Additions for InDesign
Japanese Typography: Japanese-Specific Text Attributes and Adornments
Japanese-specific text adornments.
IWaxRun
IWaxRenderData
IWaxGlyphs
<<boss class>>
kTextAdornmentKentenBoss
ITextAdornment
<<boss class>>
kTextAdornmentKentenDataBoss
ITextAdornmentData
IKentenAdornmentData (Private)
IWaxRun
IWaxRenderData
IWaxGlyphs
<<boss class>>
kTextAdornmentRubyBoss
ITextAdornment
<<boss class>>
kTextAdornmentRubyDataBoss
ITextAdornmentData
IRubyAdornmentData (Private)
•
kTextAdornmentKentenBoss: Provides the kenten drawing implementation.
•
kTextAdornmentKentenDataBoss: Provides kenten adornment related data.
•
kTextAdornmentRubyBoss: Provides the ruby drawing implementation.
•
kTextAdornmentRubyDataBoss: Provides ruby adornment related data.
IWaxRun has a few ITextAdornment and ITextAdornmentData related methods for
getting and setting adornments on a wax run.
Japanese-specific additions into kComposeStyleBoss
Text attributes (via the IAttrReport::TellComposition() method) have the
responsibility of providing hints to the paragraph composer about how text should be laid out.
These hints are summarized into a kComposeStyleBoss object, which is a non-persistent boss.
IDrawingStyle is the primary interface that carries these character attribute hints, and lists
most, but not all character attributes: font, point size, color, etc. (NOTE: This interface should
be considered a “read-only” interface because the set operations have no impact beyond this
data interface. You can obtain an instance of IDrawingStyle using
IComposeScanner::GetCompleteStyleAt() or
IComposeScanner::GetParagraphStyleAt().)
However, IDrawingStyle does not contain any Japanese text attributes. Japanese text
attributes are stored on these other interfaces on kComposeStyleBoss. (For details on each text
attribute boss, see Japanese Typography: Japanese-Specific Text Attributes and Adornments.)
•
IGridRelatedStyle: Stores text attributes that are affected by frame grid settings.
(See Interactions between Frame Grid settings and the Text Model.) Settings from the
following text attributes are stored in this interface:
—
64
kTACJKGridTrackingBoss
Japanese Feature Additions for InDesign
Japanese Typography: Japanese-Specific Text Attributes and Adornments
•
•
—
kTAGridAlignOnlyFirstLineReportBoss
—
kTAGridGyoudoriReportBoss
—
kTAGridJidoriReportBoss
—
kTAParaGyoudoriBoss
—
kTAScaleAffectsLineHeightBoss
—
kTextAttrGridAlignmentBoss
IKentenStyle: Stores text attributes related to kenten. Settings from the following
text attributes are stored in this interface:
—
kTAKentenAlignmentBoss
—
kTAKentenCharacterBoss
—
kTAKentenColorBoss
—
kTAKentenFontFamilyBoss
—
kTAKentenFontStyleBoss
—
kTAKentenKindBoss
—
kTAKentenOutlineBoss
—
kTAKentenOverprintBoss
—
kTAKentenPositionBoss
—
kTAKentenRelatedSizeBoss
—
kTAKentenSizeBoss
—
kTAKentenStrokeColorBoss
—
kTAKentenStrokeOverprintBoss
—
kTAKentenStrokeTintBoss
—
kTAKentenTintBoss
—
kTAKentenXScaleBoss
—
kTAKentenYOffsetBoss
—
kTAKentenYScaleBoss
IMojikumiStyle: Stores text attributes related to general Japanese text composition.
Settings from the following text attributes are stored in this interface:
—
kTABunriKinshiBoss
—
kTACharRotateAngleReportBoss
—
kTACJKHangingBoss
—
kTAKinsokuTableBoss
—
kTAKinsokuTypeBoss
—
kTALeadingModelBoss
Japanese Feature Additions for InDesign
65
Japanese Feature Additions for InDesign
Japanese Typography: Japanese-Specific Text Attributes and Adornments
•
66
—
kTAMojikumiAdjustPeriodBoss
—
kTAMojikumiForceBeforeSpacingBoss
—
kTAMojikumiFullAdjustBoss
—
kTAMojikumiRensuujiBoss
—
kTAMojikumiRomanWidthBoss
—
kTAMojikumiTableBoss
—
kTAOTFHVKanaBoss
—
kTAOTFProportionalBoss
—
kTAOTFRomanItalicsBoss
—
kTAShataiAdjustRotationBoss
—
kTAShataiAdjustTsumeBoss
—
kTAShataiAngleBoss
—
kTAShataiMagnificationBoss
—
kTATsumeBoss
—
kTATsumeTableBoss
IRubyStyle: Stores text attributes related to ruby. Settings from the following text
attributes are stored in this interface:
—
kTAMojiRubyBoss
—
kTARubyAdjustParentBoss
—
kTARubyAlignmentBoss
—
kTARubyAttrBoss
—
kTARubyAutoScaleMinBoss
—
kTARubyAutoScalingBoss
—
kTARubyColorBoss
—
kTARubyEdgeSpaceBoss
—
kTARubyFontStyleBoss
—
kTARubyFontUIDBoss
—
kTARubyOTProBoss
—
kTARubyOutlineBoss
—
kTARubyOverhangBoss
—
kTARubyOverhangFlagBoss
—
kTARubyOverprintBoss
—
kTARubyPointSizeBoss
—
kTARubyPositionBoss
Japanese Feature Additions for InDesign
Japanese Typography: Japanese-Specific Text Attributes and Adornments
•
•
—
kTARubyRelativeSizeBoss
—
kTARubyStringBoss
—
kTARubyStrokeColorBoss
—
kTARubyStrokeOverprintBoss
—
kTARubyStrokeTintBoss
—
kTARubyTintBoss
—
kTARubyXOffsetBoss
—
kTARubyXScaleBoss
—
kTARubyYOffsetBoss
—
kTARubyYScaleBoss
IVerticalRelatedStyle: Stores text attributes related to tate-chu-yoko and
Roman character rotation in vertical text. Settings from the following text attributes are
stored in this interface:
—
kTAKumiNumberReportBoss
—
kTARotateRomanBoss
—
kTATatechuyokoAttrBoss
—
kTATatechuyokoXOffsetBoss
—
kTATatechuyokoYOffsetBoss
IWarichuStyle: Stores text attributes related to warichu. Settings from the following
text attributes are stored in this interface:
—
kTAWarichuAlignmentBoss
—
kTAWarichuAttrBoss
—
kTAWarichuAutoResizeParenBoss
—
kTAWarichuLineSpacingBoss
—
kTAWarichuMinCharsAfterBreakBoss
—
kTAWarichuMinCharsBeforeBreakBoss
—
kTAWarichuNumOfLineBoss
—
kTAWarichuRelativeSizeBoss
Navigation Diagram
There are a few bridge methods from text-related bosses that return IAttrReport, the interface
common to all text attribute bosses:
•
IComposeScanner::QueryAttributeAt from kTextStoryBoss
•
ITextScriptUtils::QueryChildTextAttribute from kUitlsBoss
Japanese Feature Additions for InDesign
67
Japanese Feature Additions for InDesign
Japanese Typography: Japanese-Specific Text Attributes and Adornments
•
ITextAttributeSuite::QueryAttributeN from various selection suite bosses
(typecast returned IPMUnknown to IAttrReport)
•
IFocusCache::QueryAttributeN from various selection suite bosses and
kTextFocusBoss (typecast returned IPMUnknown to IAttrReport)
Commands and Notification
Refer to the ITextModelCmds interface for the list of commands to modify text attributes.
You can also use ITextAttributeSuite to modify text attributes on the current selection
context. Notification for each of these commands happen on subject on the target stories in the
item list, with theChange = cmdClassID, protocol = IID_ITEXTMODEL.
Working with Text Attributes and Adornments
Working with Japanese-specific text attributes is no different than working with ordinary
Roman text attributes, however, some types of Japanese text attributes need to be set in groups.
Setting attributes, which indirectly enables the adornments, can be done using the
ITextModelCmds and ITextAttributeSuite interfaces. Keep in mind that many
Japanese-specific text attributes and adornments get composed only with the use of a Japanese
text composer, so make sure you have set the kTextAttrComposerBoss attribute to one of the
Japanese text composers (as discussed in the section Japanese Typography: Japanese Text
Composers). Getting attributes can be done by using bridge methods (see Navigation Diagram
above) to get the IAttrReport interface on the attribute boss, and then querying for the
interface specific to the attribute.
References and Samples
There are a few code snippets that illustrate the use of Japanese-specific text attributes (and
indirectly, Japanese text adornments).
68
•
SnpPerformTextAttrKenten.cpp (SnippetRunner plug-in) shows how to set and get
kenten-related attributes.
•
SnpPerformTextAttrRuby.cpp (SnippetRunner plug-in) shows how to set and get ruby
related attributes.
•
SnpPerformTextAttrTateChuYoko.cpp (SnippetRunner plug-in) shows how to set and get
tatechuyoko related attributes.
•
SnpPerformTextAttrWarichu.cpp (SnippetRunner plug-in) shows how to set and get
warichu related attributes.
Japanese Feature Additions for InDesign
Japanese Typography: Composite Fonts
Japanese Typography: Composite Fonts
Background information and descriptions of usage scenarios
It is a common practice to mix in Japanese characters and Roman characters within the same
body of text in Japanese documents. One aesthetic issue is that full-width characters in
Japanese fonts are generally larger both in width and in height than half-width alphanumeric
characters, which make them appear de-emphasized within a body of mostly Japanese fullwidth characters. Below is a screen shot of some characters from the Kozuka Gothic Pro font,
as composed in InDesign CS-J.
The first line contains half-width alphanumeric characters, and the second line contains fullwidth characters (the “zero” is also a full-width characters). Note where the baseline is located
(indicated by the blue line) – it is a little bit above the bottom of the kasou-body box. Also,
compare the area occupied by the capital "M" on the first line and each of the glyphs on the
second line. To make this comparison easier, the glyph bounding boxes have been drawn in
magenta. One can make the font size larger for the half-width alphanumeric characters,
however, that may result in a shifting of the baseline, making the half-width alphanumeric
characters appear out of alignment. To circumvent that, you may need to shift the baseline for
such characters.
An observation one could make is that the characteristics of these characters can be grouped
into classes of characters, such as Roman half-width alphabet, half-width numerics, Japanese
kanji, Japanese kana, full-width numerics, and so forth. Furthermore, by applying a set of
attribute adjustment to classes of characters, the aesthetic quality of the text could be
improved. That is the basic principle of composite fonts, or gousei font. A gousei font is a metafont that consists of a per-character-class specification of a font plus size and positioning
adjustments. In InDesign CS-J, a user can create new composite fonts from the Type >>
Composite Fonts menu ( 書式 >> 合成フォント編集。。
。) The sample window on the
dialog allows the designer to experiment with the various settings.
Japanese Feature Additions for InDesign
69
Japanese Feature Additions for InDesign
Japanese Typography: Composite Fonts
FIGURE 1.10
Composite Font Dialog
This dialog shows a composite font with the following configuration:
TABLE 1.28 Composite Font Configuration in the Composite Font Dialog
70
Character
class
Font
Size
Baseline
Shift
Vertical
Scale
Horizontal
Scale
Centered?
Kanji
Kozuka
Gothic Pro –
Regular
100%
0%
100%
100%
No
Kana
Kozuka
Gothic Std –
Regular
100%
0%
100%
100%
Yes
Full-width
Punctuation
Kozuka
Gothic Std –
Regular
100%
0%
100%
100%
No
Full-wdith
symbols
Kozuka
Gothic Pro –
Regular
100%
0%
100%
100%
No
Japanese Feature Additions for InDesign
Japanese Typography: Composite Fonts
Character
class
Font
Size
Baseline
Shift
Vertical
Scale
Horizontal
Scale
Centered?
Half-width
alphabetic
Arial Black –
Regular
125%
-7%
100%
100%
No
Half-width
numeric
Arial Black –
Regular
125%
-7%
100%
100%
No
This configuration means:
•
For kanji characters and Full-width symbols, Kozuka Gothic Pro will be used.
•
For kana characters and Full-width punctuation, Kozuka Gothic Std will be used.
•
For half-width alphanumeric characters, Arial Black will be used with some adjustments
to the size and baseline shift. (A negative baseline shift indicates a downward shift.)
NOTE regarding the “Centered?” Column in the table: When the user chooses to scale the
glyphs of a font component, this option enables that scaling to affect the glyph only, not the
escapement. So the glyph ends up centered in its original escapement. This setting is used to
create composite fonts with "small kana". Otherwise the scaled kana’s widths would also be
scaled, rendering the font useless.
To use this composite font on a body of text, you can apply it as if you were using a noncomposite font; select a body of text and select the font from the Character panel.
This section explores the composite font model and various use cases in detail.
Class Diagram
The composite font manager ICompositeFontMgr is aggregated on the kDocWorkspaceBoss
and kWorkspaceBoss. This implementation primarily provides some utility features for the
Composite Font Dialog. Style name tables (IStyleNameTable) for composite fonts are also
aggregated in the kDocWorkspaceBoss and kWorkspaceBoss. This is where the list of
composite fonts for a particular workspace is located.
Japanese Feature Additions for InDesign
71
Japanese Feature Additions for InDesign
Japanese Typography: Composite Fonts
The composite font data is stored in a persistent boss kCompositeFontBoss. Part of the
composite font specification includes a collection of character classes. Each character class is
farmed out to a separate persistent boss kCompFontDataSettingsBoss.
Navigation Diagram
FIGURE 1.11
Navigation Diagram for the Composite Fonts Model
ICompositeFontMgr
ICompositeFontMgr
<<boss class>>
kWorkspaceBoss
<<boss class>>
kDocWorkspaceBoss
IStyleNameTable (IID_ICOMPOSITEFONTLIST)
1
IStyleNameTable::GetNthStyle
1..*
IStyleNameTable (IID_ICOMPOSITEFONTLIST)
1
IStyleNameTable::GetNthStyle
<<boss class>>
kCompositeFontBoss
ICompositeFont
1
ICompositeFont::GetCharClass
1..*
<<boss class>>
kCompFontDataSettingsBoss
ICompFontDataSettings
Generally, you would navigate from the list of the composite fonts
(IStyleNameTable/IID_ICOMPOSITEFONTLIST on workspace bosses) to a specific
kCompositeFontBoss.
In order to query a composite font list in a workspace boss, you must specify it by a specific
IID.
InterfacePtr<IWorkspace>
workSpace(Utils<ILayoutUtils>()->QueryActiveWorkspace());
InterfacePtr<IStyleNameTable>
compositeFontList(workSpace, IID_ICOMPOSITEFONTLIST);
Refer to IStyleNameTable for bridge methods that navigate from a workspace boss to a
name table entry boss.
72
Japanese Feature Additions for InDesign
Japanese Typography: Composite Fonts
Then, to navigate from a kCompositeFontBoss to a kCompFontDataSettingsBoss, use bridge
methods on ICompositeFont:
•
ICompositeFont::GetCharClass
•
ICompositeFont::GetCharClassUID()
Commands and Notification
These are are Composite Font Commands:
•
kAddCompFontClassCmdBoss
•
kCopyCompositeFontCmdBoss
•
kDeleteCompositeFontCmdBoss
•
kEditCompositeFontCmdBoss
•
kLoadCompositeFontCmdBoss
•
kNewCompositeFontCmdBoss
•
kReplaceCompositeFontCmdBoss
•
kSaveCompositeFontCmdBoss
These are the composite font commands that manipulate CMap files.
•
kCreateFontCMapCmdBoss
•
kDeleteFontCMapCmdBoss
•
kCreateDummyFontCMapCmdBoss
These are composite font commands for use with books.
•
kCreateFontInBookCmdBoss
•
kDeleteFontInBookCmdBoss
TABLE 1.29 kAddCompFontClassCmdBoss
Purpose:
Adds a character class to a composite font.
Also calls:
Japanese Feature Additions for InDesign
73
Japanese Feature Additions for InDesign
Japanese Typography: Composite Fonts
Interfaces:
•
•
•
•
ICompFontDataSettings: (Required) Contains the character class data you want to
add to the composite font.
IStringData: (Required) Name of a new composite font, if IBoolData is set to
kFalse.
IBoolData: (Optional) If you want to add a character class, set this to kTrue
(Default). If you want a new composite font to be created at the same time, set this
to kFalse. This new composite font will be based on the default composite font in
the workspace.
IUIDData: (Optional) If IBoolData is set to kTrue, this specifies the composite font
you want to add the character class to. If IBoolData is set to kFalse, this is ignored.
ItemList Input:
UID of a workspace that contains the composite font list for the composite font you want
to modify.
Observer Notification:
theChange = kAddCompFontClassCmdBoss, protocol = IID_ICOMPOSITEFONT.
Subjects for the items on the item list are notified.
ItemList Output:
None
Command usage sample:
SnpPerformCompFont.cpp (SnippetRunner plug-in)
TABLE 1.30 kCopyCompositeFontCmdBoss
Purpose:
Copies a composite font from one workspace to another.
Also calls:
None
Interfaces:
•
ItemList Input:
UID of the workspace that contains the composite font list to copy to. This is must be on
a document, or else the notification will result in an assert.
Observer Notification:
theChange = kCopyComposteFontCmdBoss, protocol = IID_ICOMPOSITEFONT.
Subjects for the items on the item list are notified.
ItemList Output:
The UID of the copied composite font on the target workspace.
Command usage sample:
None.
IUIDData: (Required) The UID of an existing composite font to copy from.
TABLE 1.31 kDeleteCompositeFontCmdBoss
74
Purpose:
Deletes a composite font from a workspace. Also removes all uses of this composite font
in a document as well as styles defined in the workspace (document or global).
Also calls:
kDeleteUIDsCmdBoss
Interfaces:
•
ItemList Input:
UID of the workspace that contains the composite font list.
Observer Notification:
theChange = kDeleteComposteFontCmdBoss, protocol = IID_ICOMPOSITEFONT.
Subjects for the items on the item list are notified.
IUIDData: (Required) The UID of an existing composite font to delete.
Japanese Feature Additions for InDesign
Japanese Typography: Composite Fonts
ItemList Output:
None.
Command usage sample:
SnpPerformCompFont.cpp (SnippetRunner plug-in)
TABLE 1.32 kEditCompositeFontCmdBoss
Purpose:
Edits a composite font in a workspace. After processing this command, it is
recommended that any stories that use this composite font be recomposed.
Also calls:
kDeleteUIDsCmdBoss
Interfaces:
•
•
ItemList Input:
UID of the workspace that contains the composite font list to edit.
Observer Notification:
theChange = kEditCompositeFontCmdBoss, protocol = IID_ICOMPOSITEFONT.
Subjects for the items on the item list are notified.
ItemList Output:
None.
Command usage sample:
None
IUIDData: (Required) The UID of an existing composite font to edit.
ICompositeFont: (Required) The composite font data. For items that are
collections, the contents of this data interface are appended to the composite font
identified by the IUIDData.
TABLE 1.33 kLoadCompositeFontCmdBoss
Purpose:
Copies a composite font from a particular workspace into another workspace. This is
similar to kCopyCompositeFontCmdBoss, but this command does the extra work of
converting UIDs to the target workspace, so this is preferred over
kCopyCompositeFontCmdBoss.
Also calls:
None.
Interfaces:
•
•
ItemList Input:
UID of the workspace that contains the composite font list to copy to.
Observer Notification:
theChange = kLoadCompositeFontCmdBoss, protocol = IID_ICOMPOSITEFONT.
Subjects for the items on the item list are notified.
ItemList Output:
None.
Command usage sample:
None
IUIDData: (Required) The UID of an existing composite font to copy from.
ICompositeFont: (Optional) Ignored.
TABLE 1.34 kNewCompositeFontCmdBoss
Purpose:
Creates a new composite font in and adds it to a composite font list in a particular
workspace.
Also calls:
None.
Japanese Feature Additions for InDesign
75
Japanese Feature Additions for InDesign
Japanese Typography: Composite Fonts
Interfaces:
•
•
ICompositeFont: (Required) Data for the new composite font.
IUIDData: Ignored.
ItemList Input:
UID of the workspace that contains the composite font list where the new composite font
should be added.
Observer Notification:
theChange = kNewCompositeFontCmdBoss, protocol = IID_ICOMPOSITEFONT.
Subjects for the items on the item list are notified.
ItemList Output:
None. To obtain the composite font just created with this command, look for the last
entry on the IStyleNameTable (IID_ICOMPOSITEFONTLIST).
Command usage sample:
SnpPerformCompFont.cpp (SnippetRunner plug-in)
TABLE 1.35 kReplaceCompositeFontCmdBoss
Purpose:
Replaces (synchronizes) composite fonts in a document. This is used from primarily
from the composite font dialog.
Also calls:
kFindChangeFormatCmdBoss, kSetOtherFindChangeOptionCmdBoss,
Interfaces:
•
ItemList Input:
UID of a document.
Observer Notification:
theChange = kReplaceCompositeFontCmdBoss, protocol = IID_ICOMPOSITEFONT.
Subjects for the items on the item list are notified.
ItemList Output:
None
Command usage sample:
None
None.
TABLE 1.36 kReadCompareCompositeFontCmdBoss
Purpose:
Used to compare if a composite font matches a file on disk. (For internal use)
Also calls:
None
Interfaces:
•
•
•
•
76
ICompositeFont: (Required) Call SetDocument() to set the document which has
the composite font in the workspace.
IStringData: (Required) Specifies the full path of the composite font file you want
to compare with.
IBoolData: (Status return) Before processing the command, set to kFalse. After
processing the command, call Get(). If kFalse, the composite font file does match
the composite font in the workspace.
IUIDData: Ignored.
ItemList Input:
UID of a document workspace.
Observer Notification:
theChange = kReadCompareCompositeFontCmdBoss, protocol =
IID_ICOMPOSITEFONT. Subjects for the items on the item list are notified.
ItemList Output:
None
Japanese Feature Additions for InDesign
Japanese Typography: Composite Fonts
Command usage sample:
None
TABLE 1.37 kSaveCompositeFontCmdBoss
Purpose:
Saves a composite font to a document and disk. (For internal use)
Also calls:
kNewCompositeFontCmdBoss
Interfaces:
•
•
•
•
ICompositeFont: (Ignored)
IStringData: (Required) Path of the composite font. You can obtain this from
ICompositeFontMgr::GetCompositeFontPath().
IBoolData: (Output) Contains a flag indicating whether the command and all
subcommands were processed properly. kTrue indicates success.
IIntData: (Optional) Special hook to indicate where the command is processed
from. The only recognized value is kCompFontSaveACopyDocResponderImpl, in
which case the kNewCompositeFontCmdBoss will be executed immediately instead
of scheduled.
ItemList Input:
UID of a document.
Observer Notification:
theChange = kSaveCompositeFontCmdBoss, protocol = IID_ICOMPOSITEFONT.
Subjects for the items on the item list are notified.
ItemList Output:
None
Command usage sample:
None
TABLE 1.38 kCreateFontCMapCmdBoss
Purpose:
Creates a CMap (character map) for a composite font.
Also calls:
kNewCompositeFontCmdBoss (as needed), kCreateDummyFontCMapCmdBoss
Interfaces:
•
•
ICompositeFont: (Required) Specifies some details of the composite font for which
you want to regenerate a CMap. Generally, only the native font family name is
required (ICompositeFont::GetNativeFontFamilyName()), unless the native font
family name contains a "<", then the Post Script name is required
(ICompositeFont::GetPostScriptName().
IUIDData: (Required) The UID of the composite font for which you want to
regenerate a CMap. This UID must be referenced from the composite font list in
the workspace you specify in the item list.
ItemList Input:
UID of a workspace that contains the composite font list
(IID_ICOMPOSITEFONTLIST) for the composite font you are going to generate a
CMap for.
Observer Notification:
None
ItemList Output:
None
Command usage sample:
None
Japanese Feature Additions for InDesign
77
Japanese Feature Additions for InDesign
Japanese Typography: Composite Fonts
TABLE 1.39 kDeleteFontCMapCmdBoss
Purpose:
Deletes a CMap (character map) for a composite font.
Also calls:
kCreateDummyFontCMapCmdBoss
Interfaces:
•
•
ItemList Input:
None
Observer Notification:
None
ItemList Output:
None
Command usage sample:
None
IStringData: (Required) Specifies the CMap file path to delete.
IUIDData: (Ignored)
TABLE 1.40 kCreateDummyFontCMapCmdBoss
Purpose:
Creates a CMap file template for a composite font. (For internal use)
Also calls:
None.
Interfaces:
•
•
ItemList Input:
None
Observer Notification:
None
ItemList Output:
None
Command usage sample:
None
IBoolData: (Ignored)
IIntData: (Optional) If you specify a non-zero number, this gets appended to the
CMap file generated.
TABLE 1.41 kCreateFontInBookCmdBoss
78
Purpose:
Makes sure that a composite fonts are available for all files in a book file. Deprecated – do
not use.
Also calls:
kCreateFontCMapCmdBoss if a new composite font needs to be created.
Interfaces:
•
•
ItemList Input:
None
Observer Notification:
None
ItemList Output:
None
Command usage sample:
None
IStringData: (Required) File path of the book file to examine.
IBoolData: (Output) The command sets this to true when the first installed
composite font is found.
Japanese Feature Additions for InDesign
Japanese Typography: Composite Fonts
TABLE 1.42 kDeleteFontInBookCmdBoss
Purpose:
Deletes composite fonts that are unused in a current book file. This is called only when
closing the last book. (For internal use)
Also calls:
None
Interfaces:
•
•
ItemList Input:
None
Observer Notification:
None
ItemList Output:
None
Command usage sample:
None
IStringData: (Ignored)
IBoolData: (Ignored)
Working with Composite Fonts
How to create a new composite font and add it to the composite font list
Creating a new composite font is a multi-step process.
1.
Create a command sequence.
2.
Process kNewCompositeFontCmdBoss to create a new composite font. At this time, the
new composite font is added to the composite font list of a workspace.
3.
For each character class you want to add into the composite font, process
kAddCompFontClassCmdBoss.
4.
Create a CMap file for the composite font by processing kCreateFontCMapCmdBoss.
5.
Make sure the font subsystem in InDesign refreshes by calling
IFontMgr::CurrentFontSystemSeed in a loop until the seed value changes.
6.
End the command sequence.
See the CreateCompFont method in SnpPerformCompFont.cpp (SnippetRunner plug-in)
for more details.
How to delete a composite font
Deleting a composite font is done by processing kDeleteCompositeFontCmdBoss. See the
Commands and Notification section above for details on this command.
How to modify a composite font
Modifying an existing composite font is done by processing kEditCompositeFontCmdBoss. See
the Commands and Notification section above for details on this command.
How to copy a composite font from one workspace to another
Copying a composite font is done by processing kLoadCompositeFontCmdBoss. See the
Commands and Notification section above for details on this command.
Japanese Feature Additions for InDesign
79
Japanese Feature Additions for InDesign
Platform Specific Character Encoding
How to get composite font information
To get details of a specific composite font, first query the IStyleNameTable interface on a
specific workspace (kDocWorkspaceBoss of a document, or kWorkspaceBoss) using the
specific IID IID_ICOMPOSITEFONTLIST, then get the UID of a specific entry so you can
query for the ICompositeFont interface of that persistent boss. Then use the Get methods
on the ICompositeFont interface to get data about the specific entries.
For example, to get the composite font named “MyCompositeFont” in a document: (Error
checking omitted for brevity)
IDocument* doc = ...; // previously obtained
UIDRef wsRef = doc-> GetDocWorkSpace (); // aggregates
IWorkspace
InterfacePtr<IStyleNameTable>
compositeFontList(wsRef, IID_ICOMPOSITEFONTLIST);
PMString fontName = "MyCompositeFont";
const UID compFontUID = compositeFontList >FindByName(fontName);
InterfacePtr<ICompositeFont>
compositeFont(wsRef.GetDataBase(),compFontUID,
UseDefaultIID());
References and Samples
Refer to the SnpPerformCompFont.cpp snippet (SnippetRunner plug-in) for an example of
manipulating composite fonts.
Platform Specific Character Encoding
Background information and descriptions of usage scenarios
One of the first character encoding standards for computers to gain wide spread acceptance
was the ASCII (American Standard Code for Information Interchange) character set. ASCII
used a 7-bit range (from Hex 00 to 7F) to describe the basic set of alphanumeric characters and
various control codes. This was sufficient for the transmission of English text between
computer systems, however, 127 characters is not enough to describe characters in a language
that has well over 3,000 characters in daily use. The introduction of modern computing
systems gave rise to various character encoding schemes, each created for a specific purpose.
For instance, a certain character set was developed to enable Japanese email to be successfully
transferred across the internet, where many 7-bit systems were used as routers.
While it is true that InDesign stores Unicode characters in the text model, understanding of the
various encoding standards is necessary when interfacing with other computer applications
through the use of InDesign’s import and export facilities and other inter-application
communication mechanisms (such as scripting, drag and drop, etc.). For instance, say you are
80
Japanese Feature Additions for InDesign
Platform Specific Character Encoding
going to implement an export filter for a proprietary file format. If your export filter is to
include Japanese support, you must know which character set is to be used so that the target
application can properly recognize the Japanese characters in the file.
Japanese Character Encoding Standards
The following table summarizes the Japanese character encoding standards used in InDesign
CS-J.
TABLE 1.43 Japanese Character Encoding Standards used by InDesign CS-J
Encoding
Description
Shift-JIS (SJIS)
One of the most widely used Japanese character encoding standards by users of personal
computers, as it is compatible between MS-DOS/Windows and Macintosh-based personal
computers, as well as ASCII-based systems.
In InDesign, this is the default PlatformChar and PMString encoding when the UI locale is
k_jaJP. This is partly because most Japanese-capable text and source code editors available for
the Macintosh and Windows platforms use Shift-JIS as the default Japanese character set. This is
also used by various import/export filters, such as text, InDesign Tagged Text, XML, Microsoft
Office format files (non-Unicode only), RTF (clipboard scrap), etc. Note that copying Unicodeonly text from applications such as Microsoft Word may not work properly.
This character encoding scheme was developed at Microsoft. Shift-JIS distinguishes between
ASCII characters and dual-byte Japanese-characters by the use of a leading byte (which ranges
from Hex 80-9F and E0-FD), and a trailing byte (which ranges from Hex 40-7F). By looking for a
leading byte in a byte stream, an application can determine if the following byte should also be
consumed to form a dual-byte Japanese character. If a leading byte is not encountered, the current
character is determined to be a single-byte character (which could be either an ASCII character or
a single-byte katakana character in the range Hex A0-DF). KanjiTalk, a Mac OS 6 extension that
enabled the use of Japanese characters on the Macintosh, also adopted Shift-JIS. (Because Shift-JIS
relies on a strict byte-ordering rule, it is compatible between Macintosh and Windows systems.
Thanks to this compatibility, you don’t need to specify an encoding converter when defining a
StringTable resource for the k_jaJP UI locale.)
One classical problem with Shift-JIS, when used with an application unaware of the Shift-JIS
character set, is that dual-byte characters would be misinterpreted in strange ways, sometimes
even split apart inadvertently at line breaks. Another problem arose from the fact that one of the
possible trailing bytes is the backslash character (“\”, Hex 5C), which is also used as an escape
sequence in string literals for C programs. These problems together gave rise to the term “mojibake” ( 文字化け ), which literally means “a character that turned into something else”.
A note about PMString: In previous InDesign versions, the OSes supported were dependent on
using platform encodings in the UI. This meant that UI code would use PMStrings instead of
WideStrings (UTF-16) for string display. When displaying characters that did not exist in the
current code page/script, PMString could convert to Hex notation. However, current OSes now
can display Unicode in the UI, so when dealing with text data, try to avoid conversion into
Platform encodings, that is, use WideString, and do not force PMString to convert to
platform characters), which can result in data loss in Japanese and other languages.
Japanese Feature Additions for InDesign
81
Japanese Feature Additions for InDesign
Platform Specific Character Encoding
Encoding
Description
JIS or ISO2022-JP
Primarily for in email systems, since all characters can be expressed as a combination of 7-bit
characters. The JIS character encoding standard utilizes an encoding mode that indicates whether
the current section of a byte stream is to be interpreted as regular ASCII, or some dual-byte
Japanese character, etc. The mode is switched by an escape sequences that start with ESC (Hex
1B). This helps drive a state machine that reads JIS-encoded characters.
In InDesign CS-J, this is only used for specifying characters in the mojikumi dialog, the kenten
dialog, the kinsoku dialog, and the composite font dialog.
Kuten-code
A character set used by keyboards of mainframe information systems in Japan, where characters
were specified by a section number (ku) and an identifier (ten). Similar to the JIS character
standard, this is only used for specifying characters in InDesign CS-J’s mojikumi dialog, kenten
dialog, kinsoku dialog, and composite font dialog.
EUC-JP
(UNIX)
Primarily for UNIX systems (including UNIX-based email). Not used in InDesign CS-J.
Unicode (UTF8, UTF-16,
UTF-32)
Developed by the Unicode Consortium, and used extensively in the InDesign text model, as well
as many of the modern personal computer operating systems. Refer to the “Unicode 3.x and
String-Related APIs in InDesign CS/InCopy CS” technote (unicodeandstrings.pdf).
Adobe-Japan-14
This is not particularly a character encoding standard, but a glyph ID standard for fonts,
established by Adobe Systems. The numbers at the end of the name refers to the version (1.4).
Japanese fonts that adhere to this standard have a common glyphID to character code mapping.
There are a few other proprietary encoding schemes in use in Japan, since they are not
recognized in InDesign, their mention has been omitted from this document.
Further Information about Japanese character encoding
The Unicode standard includes the ability for users to add end-user defined glyphs, or “gaiji”.
The code region set aside for this purpose is called the Private Use Area (PUA). Many Japanese
font vendors and designers use this area to define their proprietary symbols in Japanese fonts.
Another common feature of Japanese fonts is the inclusion of alternate glyphs forms, known as
“itaiji”. For example, the Kozuka Mincho Pro and Kozuka Gothic Pro OpenType fonts offer
many variations of the character for “nabe” in the Japanese surname “Watanabe”. Of these
variants of the same character (as opposed to glyph), some have the same Unicode code point,
and others have different Unicode code points, as defined by the Unicode Consortium.
Here are the various character-to-glyph mapping scenarios supported in InDesign CS-J:
82
•
Normal glyph: For a standard Unicode code point, there is a unique glyph ID (which can
then be mapped back to the Unicode code point)
•
Itaiji: For a standard Unicode code point, there are multiple glyph IDs, which are
distinguished by further attributes, such as OpenType feature tags. (More on this in the
section Special Features for OpenType Fonts.)
•
Gaiji: Glyphs that are outside a standard encoding. Some gaiji glyphs are encoded in the
Unicode PUA (Hex E000 to F8FF), others are simply not encoded, and are only accessible
with OpenType feature tags. InDesign stores such glyphs using two special codepoints
Japanese Feature Additions for InDesign
Platform Specific Character Encoding
(one for Japanese glyphs and one for non-Japanese glyphs), and uses a text attribute to
encode the character ID (CID) of the special glyph so the text composer can measure and
draw it. Use of the PUA for gaiji is not encouraged, because of portability issues.
•
Non-Unicode Glyph: For a glyph, there is no Unicode code point. There are a handful of
glyphs defined in the Adobe Japan 1-4 glyph set but do not have any Unicode code points.
These scenarios are illustrated in the code snippet, SnpInsertGlyph.cpp (SnippetRunner plugin).
Working with Japanese character encoding standards
General Precautions when using PMString and Unicode in the InDesign API
As mentioned earlier, the default platform character encoding in InDesign when the UI locale
is set to k_jaJP is Shift-JIS. European characters, such as those with umlauts, accents,
limacons, inverted exclamation point, etc., are specified in the byte range Hex 80-FE in the
ASCII character set. (Note that there are differences between the Macintosh and Windows
platforms, which is why you must specify an encoding converter in a StringTable resource for
most Roman languages.) These characters, unfortunately, do not have representations in ShiftJIS, as the byte range Hex 80-FE have different meaning. Those characters will represented in
the PMString class in its “embedded form”, for example, “<00A1>” (inverted exclamation
point.) If you want to store this character in a PMString in its non-embedded form, you can
set the encoding (Unicode script) in the PMString constructor to
PMString::kEncodingASCII, or call
PMString::SetEncoding(PMString::kEncodingASCII). Furthermore, these
European characters must be rendered using a font that has the appropriate glyphs. Most
Unicode-based fonts, such as OpenType fonts, have no problem with European characters.
However, the default UI font used on Japanese versions of Windows, may not.
For more details on PMString and Unicode in the InDesign API, refer to the “Unicode 3.x
and String-Related APIs in InDesign CS/InCopy CS” technote (unicodeandstrings.pdf) for
details about using PMString and other Unicode-related classes (WideString,
UTF32TextChar, and UTF16TextChar) in the InDesign API.
How to convert characters across different Japanese character encodings
There are a few APIs you can use to convert Japanese characters from one encoding to another.
•
IEncodingUtils (on kUtilsBoss): This interface has many methods for converting
characters between JIS, Shift-JIS, Unicode, Kuten-code, using various InDesign string
base types. This interface also has a few methods to check if a byte is a possible Shift-JIS
leading byte or trailing byte.
•
CTUnicodeTranslator: This utility class contains methods to convert Unicode
characters and strings to platform character encodings. You can use the
PMString::StringEncoding enum to specify the script parameter. See
{SDK}/source/public/includes/CTUnicodeTranslator.h.
You can also refer to the TextExportFilter and TextImportFilter sample plug-ins, which
illustrate how to read and write Shift-JIS and JIS encoded text files. (The Shift-JIS and JIS
Japanese Feature Additions for InDesign
83
Japanese Feature Additions for InDesign
Platform Specific Character Encoding
options will only show up during the run-time of these plug-ins if you are running InDesign
CS-J.)
Special Features for OpenType Fonts
There are several font-related features that are specific to Japanese (as well as Chinese and
Korean) fonts. There are several Roman “Pro” fonts that have special features as well. In
OpenType, these special features are identified by feature tags.
(http://partners.adobe.com/asn/tech/type/opentype/feattags.jsp) The following InDesign APIs
allow you to access feature tags.
•
IPMFont: This interface has a few OpenType feature tag related methods. See
HasOTFeature(), PeekOTFeatures(), GetOTGlyphAccess(). PeekOTFeatures() returns a
const char* that stores the OpenType flags in 4-byte segments. Take every 4th byte,
typecast it to a long* and then dereference it to get the tag value as a long integer (e.g.
‘aalt’). You can use this in conjunction with
IGlyphUtils::GetOTFFeatureGlyphSet (see below) to obtain the GlyphIDs
for all of the OpenType feature tags supported in a font.
•
GlyphAccessData: Stores information about a specific glyph, including OpenType
features. Returned from IGlyphUtils::GetGlyphAccessInfo, which takes a
GlyphID and returns information about it.
•
CTUnicodeTranslator::GlyphIDToTextChar: Takes a font (IPMFont) and a
GlyphID, and finds the corresponding Unicode codepoint. This method should find
either 1 Unicode codepoint, or none.
•
IGlyphUtils::GetOTFFeatureGlyphSet: Gets a list of glyphs in a font that
have a particular OpenType feature tag.
•
OneOTFeature: Stores a set of OpenType feature tags.
•
OpenTypeFeatureList: A vector container for OneOTFeature.
Here is a list of text attribute bosses that pertain to OpenType specific feature tags.
84
•
kTextAttrGlyphFormBoss: A text attribute boss (character attribute) that represents the
OpenType glyph form on the targeted text run.
•
kTextAttrOTFeatureListBoss: A text attribute boss (character attribute) that represents
the list of OpenType features on the targeted text run.
•
kTAOTFHVKanaBoss: A text attribute that represents whether the OpenType
horizontal/vertical kana forms are applied on the targeted text run. This option is
available from the UI under the Character Panel flyout menu >> OpenType features.
•
kTAOTFProportionalBoss: A text attribute that represents whether the OpenType
proportional metrics are applied on the targeted text run. This option is available from
the UI under the Character Panel flyout menu >> OpenType features.
•
kTAOTFRomanItalicsBoss: A text attribute that represents whether the OpenType
Roman-style italics (as opposed to Shatai) are applied on the targeted text run. This
option is available from the UI under the Character Panel flyout menu >> OpenType
features.
Japanese Feature Additions for InDesign
Platform Specific Character Encoding
How to find out information about a particular glyph in a font
You can use IGlyphUtils::GetGlyphAccessInfo to determine details about a
particular glyph (identified by Text::GlyphID) in a font (IPMFont).
Text::GlyphID glyph = ...; // specify
IPMFont* font = ...; // obtained prior to this code
GlyphAccessData glyphAccessData;
if(Utils<IGlyphUtils>()->
GetGlyphAccessInfo(glyph, font, &glyphAccessData) == 0
&&
glyphAccessData.fFeatureList.Length() &&
glyphAccessData.fTextChars.Length())
{
K2Vector<Text::GlyphID> glyphIDs;
font->GetGlyphIDs(glyphAccessData.fTextChars, glyphIDs);
// iterate though glyphIDs...;
}
How to inserting a glyph by a specific glyph ID
Ideally, we should be inserting a character by its Unicode code point into the text model.
However, as stated in the section “Further Information about Japanese character encoding”,
that is not always possible since some glyphs in Japanese fonts do not have Unicode codepoints.
The code snippet SnpInsertGlyph (SnippetRunner plug-in) illustrates how to determine if a
glyph has a Unicode codepoint or not. If it does, it will insert it into the text model using its
Unicode codepoint, plus optional OpenType feature tags, however, if it does not, it will insert a
placeholder character (kTextChar_SpecialGlyph or
kTextChar_NonRomanSpecialGlyph) and apply the kTextAttrSpecialGlyphBoss text
attribute on that place holder character to specify the GlyphID of choice. (This must be
coupled with the font settings, since GlyphIDs may differ by font.) This instructs the Japanese
text composers to draw the specific GlyphID.
The caveat with inserting glyphs without a Unicode codepoint is that, when you export this
character using the application-provided text export filter or XML export, you only get the
place holder character. Any import and export workflow you use must support the extra
GlyphID attribute. An import/export filter that does support the extra GlyphID attribute is the
InDesign Tagged Text filter; it does it through the “cSpecialGlyph” (verbose) or “pSG”
(abbreviated) tag.
References and Samples
There are several samples in the SDK that deal with Japanese character encodings:
•
TextImportFilter and TextOutputFilter: These two plug-ins implement an import
provider and export provider, respectively. When run under the Roman feature set, these
plug-ins provide options to import and export ASCII and Unicode text files with a .cpp
file extension. When run under the Japanese feature set, these plug-ins provide addition
Shift-JIS and JIS options.
Japanese Feature Additions for InDesign
85
Japanese Feature Additions for InDesign
Input Method Editor
•
SnpInsertGlyph.cpp (SnippetRunner plug-in): This sample shows how to insert a glyph
by font and glyph ID.
An excellent reference book that provides a tremendous amount of detail about not only
Japanese character sets but also Chinese, Korean, and Vietnamese character sets, is the book
“CJKV Information Processing”, by Ken Lunde. (http://www.oreilly.com/catalog/cjkvinfo/)
In addition, the “Unicode 3.x and String-Related APIs in InDesign CS/InCopy CS” technote
(unicodeandstrings.pdf) includes details about using Unicode and various string APIsin the
SDK.
Input Method Editor
Background information and descriptions of usage scenarios
All of the wonderful Japanese features mentioned so far in this document mean nothing if you
cannot key in Japanese characters into a text frame or a field in a user interface widget. As
mentioned earlier, the Japanese language has over 3,000 characters in daily use (and many
many more if you include alternate forms and other symbols), so a special mechanism must be
in place to enter characters using a regular QWERTY keyboard. This mechanism is called Front
End Processing (FEP) of key events, and the component that is responsible for FEP is called an
Input Method Editor (IME). Normally, if an application doesn’t provide special provisions for
characters sets that require FEP, the default behavior provided by internationalized operating
systems is to present a floating IME window that stages the keystrokes hit by the user, so that
the user can interactively convert them to ideographic characters of choice.
However, having this floating window appear and disappear while you are entering a text story
may be very distracting for some users. Therefore, InDesign CS-J has a preference to allow
86
Japanese Feature Additions for InDesign
Input Method Editor
users to type text “inline”, directly into a text frame or a UI widget (e.g. TextEditWidget). Note
that the logic for the checkbox in the red rectangle (which reads “Use Inline Entry for nonRoman characters”) is inverted from the preferences interface that sets the value. This inline
IME feature is only exposed via the Japanese feature set, however, the preference interface exists
for all locales and feature sets.
A user would enter Japanese characters into InDesign CS-J by following these steps:
1.
Enable the IME for the operating system so that Japanese characters are entered. (This
example uses the Windows XP IME in Hiragana/Roma-ji entry mode.)
2.
Place the text insertion point somewhere in a text frame and start typing Japanese
characters phonetically (in Roma-ji, a method of phonetically transliterating Japanese
Japanese Feature Additions for InDesign
87
Japanese Feature Additions for InDesign
Input Method Editor
using the English Alphabet). Here, the user has typed in “shinnyokohama”. The Roman-
keystrokes get translated to Hiragana characters on the fly, and the IME candidate has a
gray underline, providing visual feedback that the user needs to convert these characters.
3.
The user hits the space bar to show the possible conversion candidates for
“shinnyokohama”.
There are three possible conversions, as shown in the selection list that pops up right
underneath.
4.
Since the first candidate is the desired one, the user hits the [Enter] key, and the typed-in
hiragana characters that correspond to “shinnyokohama” is now converted to the proper
pronoun in Kanji (“Shinyokohama” is the name of a train station). The text cursor is
automatically advanced to the right of the Kanji, the gray underline disappears,
indicating the user can enter more text.
If the user mistyped in step 2, the user can hit the [Escape] key to erase the characters to be
convereted.
This section explores how the InDesign CS-J IME interacts with other InDesign subsystems,
such as text.
88
Japanese Feature Additions for InDesign
Input Method Editor
Class Diagram
The IME Model
The kCJKIMEBoss provides the IME implementation. The IEventHandler and the
IIMEEventHandler implementations provide the OS interaction with key events and
drives the rest of the IME interaction in the application. The start of the IME process begins
with activating the IME context. (See below) Upon receiving specific key events from the OS,
the IME event handler adrives the insertion of text and the kTAIMECompModeBoss text
attribute by delegating to the IInputEditor.
The global IME preference is represented by the IIMEPrefs interface on kWorkspaceBoss.
This stores the user’s preference on whether to use an inline IME or a floating window.
The IME-based text editor component is represented by kTextEditorBoss. The IObserver
(non-standard IID) implementation in this boss drives activation of IME context based on
focus (text focus, page item focus).
The IME component of InDesign CS-J keeps track of whether the IME subsystem is necessary
to process keystrokes, by means of the IIMEContext interface on kDocWindowBoss. This
includes activating and deactivating the IME, as well as enabling and disable the keystroke
event handler.
Japanese Feature Additions for InDesign
89
Japanese Feature Additions for InDesign
Input Method Editor
IME Drawing
These boss classes are involved in giving the user visual feedback that a conversion is necessary
or pending. These are primarily used by InDesign’s own text editing architecture, and therefore
are not very useful for general purposes. These are listed here only as a reference.
The kTextAdornmentIMEHintsBoss boss provides the implementation for drawing the gray
underline indicator (the IME inline editing adornment.)
The kTextAdornmentIMEHintsDataBoss provides access to the text attribute data from the
adornment.
The kTAIMECompModeBoss represents the text attribute (character attribute) that is used by
the IME during editing. Enabling this text attribute drives the text adornment to draw.
kWritingModeWidgetBoss represents the text adornment code in the story editor window.
Navigation Diagram
Since the majority of the IME implementation in InDesign CS-J relies on private interfaces,
there is not much to discuss except that the enabling of the text attribute drives the drawing of
the gray underline text adornment.
Commands and Notification
TABLE 1.44 kSetIMEPrefsCmdBoss
90
Purpose:
Sets IME style preferences (inline or floating window).
Also calls:
None.
Interfaces:
•
ItemList Input:
None.
Observer Notification:
theChange = kSetIMEPrefsCmdBoss, protocol = IID_IIMEPREFERENCES
The subject on the global workspace (kWorkspaceBoss) is used for notification.
IIMEPrefsCmdData: (Required) Specify whether you want to use a floating
window, and if you want to use a “fake” input window (unsupported).
Japanese Feature Additions for InDesign
Input Method Editor
ItemList Output:
None
Command usage sample:
None.
Working with IMEFeatures
How to get and set IME preferences
Getting the IME preference (using inlined IME for no-roman chraracters) is a matter of
querying the IIMEPrefs (IID_IIMEPREFERENCES) interface on the WorkspaceBoss.
NOTE: The FakeInputWindow methods are not used on this interface. Setting the IME
preference can be accomplished by processing the kSetIMEPrefsCmdBoss. Note that the logic is
inverted from the checkbox on the text preference dialog (Edit >> Preferences >> Text). Just
like in IIMEPrefs, the useFakeInputWindow in the IIMEPrefsCmdData::Set()
method is ignored.
(Advanced) Implementing your own IME component
The InDesign CS-J IME components are finely tuned to Japanese character entry. In the
current version, entry of characters from other Far Eastern character sets, such as Simplified
Chinese, Traditional Chinese, and Korean, result in incorrect text data. The IME components
do not get installed with InDesign CS, and trying to enter Chinese or Korean characters using
the OS-provided IME services with InDesign CS may result in more text entry problems.
Therefore, one may conclude that a set of IME components similar to the set installed with
InDesign CS-J may be necessary.
Details of a custom IME component implementation is beyond the scope of this document, as
it requires platform specific APIs such as Windows IMM calls or Apple Type Services for
Unicode Imaging (ATSUI), however, a custom IME would start with the installation of a event
handler at the application level (using IEventDispatcher on kAppBoss), and trapping
platform events in the IEventHandler interface. Based on the events you receive, you
would either:
•
Determine if you the user is typing in a text frame. If so, enable some flag that indicates
that IME conversion is on-going.
•
Set the kTAIMECompModeBoss text attribute to trigger the text adornment for the IME
candidates.
•
When the user commits to a conversion, remove the typed in characters and replace it
with the converted characters and remove the text attribute.
References and Samples
There are no SDK-provided samples on using IME preferences or customizing the IME
component altogether, however here are some references to platform specific APIs.
•
Microsoft Developer Network (MSDN) pages on Input Method Editor Development:
http://msdn.microsoft.com/library/default.asp?url=/library/en-
Japanese Feature Additions for InDesign
91
Japanese Feature Additions for InDesign
Summary
us/appendix/hh/appendix/imeimes_0h2s.asp or search on http://msdn.microsoft.com/
for “IME”
•
Apple Developer Association (ADA) pages on ATSUI:
http://developer.apple.com/intl/atsui.html
Summary
This document provided an introduction to various Japanese-specific features of InDesign CSJ. The introductions of features were targeted for developers who need to tailor their existing
solutions to the Japanese market, but are not too familiar with all of the features. This
document also provided technical details that would allow a developer to automate and
customize the following InDesign subsystems:
•
Feature sets.
•
Japanese page layout: Layout grids , frame grids, and measurement units.
•
Japanese typography: Typographic rules (mojikumi), text attributes and adornments,
and composite fonts.
•
Japanese specific character encodings.
•
Input method editor.
With each section, this document explained the motivation for a specialized worklow, provided
class and navigation diagrams to allow a conceptual mapping from feature-to-model, listed out
specific APIs and commands for the subsystem, and iterated through what are believed to be
common use cases in each subsystem. References to examples and other documents should
provide further motivation for learning these subsystems in depth.
92