ParagraphStyle
存储与Photoshop用户界面中的段落面板有关的属性的类。
Properties
名称 | 类型 | 访问 | 默认 | 范围 | 最低版本 | 描述 |
---|---|---|---|---|---|---|
features | TypeInterfaceFeatures | R W | TypeInterfaceFeatures.DEFAULT | - | 24.1 | 要显示的段落UI特征。 |
firstLineIndent | number | R W | - | -1296..1296 | 24.1 | 在72ppi的文件中,缩进第一行段落的空间,单位是像素。 |
hyphenation | boolean | R W | false | - | 24.1 | 真,以便在换词中使用连字符。使用hyphenationFeatures来实现最大的控制。 |
hyphenationFeatures | HyphenationProperties | R W | - | - | 24.1 | The hyphenation features as they're displayed in the dialog found in the Paragraph's flyout menu "Hyphenation...". They're expressed with an option object with the following properties (numbers are in pixels): ```javascript { // The minimum number of letters a word must have in order for hyphenation // in word wrap to be allowed. In the range [2, 25], default 5. wordsLongerThan: number, // The minimum number of letters after which hyphenation // in word wrap is allowed. In the range [1, 15], default 2. afterFirst: number, // The minimum number of letters before which hyphenation // in word wrap is allowed. In the range [1, 15], default 2. beforeLast: number, // The maximum number of consecutive lines that can end with a hyphenated word. // In the range [2, 25], default 2. limit: number, // The distance in pixels at the end of a line that will cause a word // to break in unjustified type. In the range of [0, 8640] pixels for a 72PPI document. // If the document resolution is different, the max. value is scaled accordingly. // Default: 36px (72PPI) zone: number, // True to allow hyphenation in word wrap of capitalized words. Default true. capitalWords: boolean } ``` The hyphenationFeatures getter returns an object with all the features: ```javascript const textItem = app.activeDocument.activeLayers[0].textItem; textItem.paragraphStyle.hyphenationFeatures; // { // wordsLongerThan: 5, // afterFirst: 2, // beforeLast: 2, // limit: 2, // zone: 36, // capitalWords: true // } ``` In the object that is passed to the setter, all the properties are optional; the ones that are not specified will be assigned the default values. ```javascript textItem.paragraphStyle.hyphenationFeatures = { wordsLongerThan: 10, afterFirst: 3 }; // { // wordsLongerThan: 10, // afterFirst: 3, // beforeLast: 2, // limit: 2, // zone: 36, // capitalWords: true // } ``` |
justification | Justification | R W | Justification.LEFT | - | 24.1 | The paragraph justification. |
justificationFeatures | JustificationProperties | R W | - | - | 24.1 | The justification features as they're displayed in the dialog found in the Paragraph's flyout menu "Justification...". They're expressed with an option object with the following properties (all percentage numbers): ```javascript { // Minimum, Desired and Maximum percentage of normal word spacing wordSpacingMinimum: number, wordSpacingDesired: number, wordSpacingMaximum: number, // Minimum, Desired and Maximum percentage of normal letter spacing letterSpacingMinimum: number, letterSpacingDesired: number, letterSpacingMaximum: number, // Minimum, Desired and Maximum percentage of normal glyph scaling glyphScalingMinimum: number, glyphScalingDesired: number, glyphScalingMaximum: number // Percentage of type size to use for auto leading autoLeadingAmount: number } ``` Unless it's been set, the justificationFeatures value is `null`. The setter allows you to set individual properties: the missing ones will be either filled with the default values or left untouched. Properties' ranges are as follows: WordSpacing: 0 <= Minimum <= Maximum Minimum <= Desired <= Maximum Minimum <= Maximum <= 1000 LetterSpacing: -100 <= Minimum <= Maximum Minimum <= Desired <= Maximum Minimum <= Maximum <= 500 GlyphScaling: 50 <= Minimum <= Maximum Minimum <= Desired <= Maximum Minimum <= Maximum <= 200 AutoLeading: 0 <= AutoLeading <= 500 |
kashidaWidth | KashidaWidthType | R W | KashidaWidthType.MEDIUM | - | 24.1 | 卡西达(TATWEEL)字符的宽度 |
kinsoku | Kinsoku | R W | Kinsoku.NONE | - | 24.1 | 日语文本的断行规则(Kinsoku Shori)。 |
layoutMode | ParagraphLayout | R W | ParagraphLayout.WORLD | - | 24.1 | 段落布局模式。 |
leftIndent | number | R W | - | -1296..1296 | 24.1 | 在72ppi的文件中,从左边缩进文本的空间,单位是像素。 |
mojikumi | Mojikumi | R W | Mojikumi.NONE | - | 24.1 | 日语文本中标点、符号、数字和其他字符类别之间的间距。 |
rightIndent | number | R W | - | -1296..1296 | 24.1 | 在72ppi的文件中,从右边缩进文本的空间,单位是像素。 |
spaceAfter | number | R W | - | -1296..1296 | 24.1 | 在72ppi的文件中,每段后面要使用的空间,单位是像素。 |
spaceBefore | number | R W | - | -1296..1296 | 24.1 | 在72ppi的文件中,每个段落前要使用的空间,单位是像素。 |
Methods
reset
24.1async : Promise<void>
将段落样式重置为其默认值。