XML-Technologien / XSL-FO / Referenz / Antenna House Formatter XSL Extensions / Properties / hanging-punctuation

(Auszug aus "XSL-FO ― Die Referenz" von Manuel Montero Pineda & Steffen Herkert, 2016, dpunkt.verlag)

A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z

Category Trimming and Hanging

Specifies whether to hang punctuations at the start of the line or end of the line. [CSS3-Text] Hanging Punctuation: the ‘hanging-punctuation’ property

Value:

none | [ start || first || [ force-end | allow-end ] || last ]

Initial:

none

Applies to:

fo:block

Inherited:

yes

Percentages:

N/A

Values have the following meanings.

none

Do not hang punctuations at the start of the line or end of the line.

start

Hangs punctuations at the start of the line. If the target character for hanging comes to the start of the line, the character is hanged forcibly.

first

Behaves as the same as the start value only with the start line of a paragraph.

force-end

Hangs punctuations at the end of the line. When text-align="right" or text-align="justify" (or text-align-last="justify") is specified and a target character for hanging comes to the end of the sentence, the character is hanged forcibly. When anything else is specified to text-align, the character is hanged naturally. the end value before V5 is taken as the allow-end value.

allow-end

Hangs punctuations at the end of the line. When text-align="right" or text-align="justify" (or text-align-last="justify") is specified and a target character for hanging comes to the end of the sentence, the character is not hanged if text fits into one line, the character is hanged if text does not fit into one line. When anything else is specified to text-align, the character is hanged naturally.

last

Behaves the same as the force-end value only with the end of the line of a paragraph.

The target punctuation marks is as follows.

  • force-end, allow-end
    Japanese or Simplified Chinese

    U+3001

    IDEOGRAPHIC COMMA

    、

    U+3002

    IDEOGRAPHIC FULL STOP

    。

    U+FF0C

    FULLWIDTH COMMA

    ,

    U+FF0E

    FULLWIDTH FULL STOP

    .

    Traditional Chinese

    U+FE50

    SMALL COMMA

    ﹐

    U+FE51

    SMALL IDEOGRAPHIC

    ﹑

    U+FE52

    SMALL FULL STOP

    ﹒

    U+FF64

    HALFWIDTH IDEOGRAPHIC COMMA

    、

    Other languages

    Same as the last value.

  • last
    quotation marks, closing parentheses, period, comma and hyphen

  • start, first
    quotation marks, closing parentheses and bullet

XSL-FO sample:

<fo:root xml:lang="en" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:cpfo="http://www.compart.net/xmlns/cpfo" xmlns:svg="http://www.w3.org/2000/svg" xmlns:axf="http://www.antennahouse.com/names/XSL/Extensions">
<axf:document-info name="document-title" value="Hanging punctuation at the start /end of line"/>
<axf:document-info name="author" value="Antenna House, Inc."/>
<fo:layout-master-set>
<fo:simple-page-master page-height="297mm" page-width="210mm" margin-top="10mm" margin-left="20mm" margin-right="20mm" margin-bottom="10mm" master-name="PageMaster1">
<fo:region-after extent="7mm"/>
<fo:region-body margin-top="0mm" margin-left="0mm" margin-right="0mm" margin-bottom="10mm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="PageMaster1">
<fo:static-content flow-name="xsl-region-after">
<fo:block font-size="0.8em" text-align="right" color="green">
<fo:basic-link external-destination="http://www.antennahouse.com/">
Antenna House, Inc.
</fo:basic-link>
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body" font-family="serif" font-size="1em" line-height="1.4" axf:hyphenate-hyphenated-word="false" hyphenate="true">
<fo:block span="all" font-family="sans-serif" font-size="2em" font-weight="bold" line-height="2" space-before="1em" space-after="1em" space-before.conditionality="retain" space-after.conditionality="retain" background-color="#EEEEEE">
<fo:block start-indent="1em" end-indent="1em">
Hanging punctuation at the start /end of line
</fo:block>
</fo:block>
<fo:block span="all" space-before="1em" space-after="1em" space-after.conditionality="retain" text-indent="0em" border="1pt solid #9999FF" start-indent="0.5em" end-indent="0.5em" padding="0.5em" text-align="justify">
Specifies whether the hanging punctuation at the start and end of a line is applied. If axf:hanging-punctuation is specified, hanging punctuation is not applied. If start is specified, hanging punctuation is applied at the start of a line. text-align="right" or text-align="justify" can be specified together with the force-end property, then the full-width punctuation comes at the end of a line, it is forced to be hanged. The other settings are explained in this sample. See also XSL/CSS extension in the manual to learn more about the corresponding punctuations.
</fo:block>
<fo:block text-align="justify">
<fo:block font-size="1.2em">
none
</fo:block>
<fo:block-container space-after="0.5em" font-size="1.5em" width="5.5em" axf:hanging-punctuation="none">
<fo:block background="orange" xml:lang="ja">
「あいうえお、
</fo:block>
</fo:block-container>
<fo:block font-size="1.2em">
start
</fo:block>
<fo:block-container space-after="0.5em" font-size="1.5em" width="5.5em" axf:hanging-punctuation="start">
<fo:block background="orange" xml:lang="ja">
「あいうえお、
</fo:block>
</fo:block-container>
<fo:block font-size="1.2em">
force-end
</fo:block>
<fo:block-container space-after="1.5em" font-size="1.5em" width="5.5em" axf:hanging-punctuation="force-end">
<fo:block background="orange" xml:lang="ja">
「あいうえお、
</fo:block>
</fo:block-container>
<fo:block font-size="1.2em">
first
</fo:block>
<fo:block>
The same behavior as start is applied only at the first line of a paragraph.
</fo:block>
<fo:block-container space-after="0.5em" font-size="1.5em" width="5.5em" axf:hanging-punctuation="first">
<fo:block background="orange" xml:lang="ja">
「あいうえお」「かきく
</fo:block>
</fo:block-container>
<fo:block font-size="1.2em">
allow-end
</fo:block>
<fo:block>
When the target character to be hanged comes at the end of a line, it isn't hanged when fitting into a line, it is hanged when not fitting into a line.
</fo:block>
<fo:block-container space-after="0.5em" font-size="1.5em" width="5.5em" axf:hanging-punctuation="allow-end">
<fo:block background="orange" xml:lang="ja">
あいうえお、「かきくけこ、
</fo:block>
</fo:block-container>
<fo:block font-size="1.2em">
last
</fo:block>
<fo:block>
 The same behavior as force-end is applied only at the end line of a paragraph.
</fo:block>
<fo:block-container space-after="1.5em" font-size="1.5em" width="5.0em" axf:hanging-punctuation="last">
<fo:block background="orange" xml:lang="ja">
あいうえおかきくけこ、さしすせそたちつ、
</fo:block>
</fo:block-container>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>

Download der Beispiele

Output:

nach oben