Character unit

From Apache OpenOffice Wiki
Jump to: navigation, search

Character unit overview

In CJK, especailly in China, character is used as a unit to measure some paragraph attributes, such as indentation, line spacing and tab stop. etc. Character unit is most useful in processing Chinese. For example, users are used to use two characters as the indent of first line of the paragraph.

**大家好

大家好,才是真的好

With character unit, users need not worry about the layout confusion due to font size changing.

For line spacing of paragraph, line unit is used.

Feature

Implementation

File format support

ODF support

As mentioned above, Characters unit is most used in left and right margins for a paragraph, and the indentation of first line for a paragraph. Line unit is used in top and bottom margins for a paragraph.

While ODF does not support character unit and line unit yet.

  • Character Unit

In order to support character unit, "em" measurement should be added support in ODF.

"em" is a unit-based value of relative length that is measured against the current value of the font-size property.

There is only one relative unit of measure, the "em". The definition of "1em" is equal to the current font size. For example, a value of "1.25em" is 1.25 times the current font size.

When an em measurement is used in an expression, it is converted according to the font-size value of the current property's context. The result of the expression is an absolute length.

For example, ODF V1.2 section 15.5.7 defines the schema of the left and right margins for a paragraph:

[xml] <define name="style-paragraph-properties-attlist" combine="interleave"> [1] </define>

<define name="common-horizontal-margin-attlist"> <optional> <attribute name="fo:margin-left"> <choice> [2] [3] </choice> </attribute> </optional> <optional> <attribute name="fo:margin-right"> <choice> [2] [3] </choice> </attribute> </optional> </define>

"em" measurement is added in "length" [xml] <define name="length"> <param name="pattern">-?([0-9]+(\.[0-9]*)?|\.[0-9]+)((cm)|(mm)|(in)|(pt)|(pc)|(px)|(em))</param>

</define>

  • Line Unit

The schema of top and bottom margins for a paragraph is: (ODF V1.2 section 15.2.20). [xml] <define name="style-paragraph-properties-attlist" combine="interleave"> [4] </define>

<define name="common-vertical-margin-attlist"> <optional> <attribute name="fo:margin-top"> <choice> [5] [3] </choice> </attribute> </optional> <optional> <attribute name="fo:margin-bottom"> <choice> [5] [3] </choice> </attribute> </optional> </define>

Percentage unit can be reused as line unit to specify the top and bottom margins for a paragraph, just like the fix line height in section 15.5.1. For example, a value of "125%" is 1.25 times for the highest character in a line.

Appendix

Both OpenXML and UOF (Chinese office file format) support Character/Line measurement unit.

Open XML support

  • Line Spacing in Line Units

[xml]

 <xsd:complexType name="CT_Spacing">
   <xsd:attribute name="beforeLines" type="ST_DecimalNumber" use="optional">
     <xsd:annotation>
       <xsd:documentation>Spacing Above Paragraph IN Line Units</xsd:documentation>
     </xsd:annotation>
   </xsd:attribute>
   <xsd:attribute name="afterLines" type="ST_DecimalNumber" use="optional">
     <xsd:annotation>
       <xsd:documentation>Spacing Below Paragraph in Line Units</xsd:documentation>
     </xsd:annotation>
   </xsd:attribute>
 </xsd:complexType>

  • Indentation In Character Units

[xml]

 <xsd:complexType name="CT_Ind">
   <xsd:attribute name="leftChars" type="ST_DecimalNumber" use="optional">
     <xsd:annotation>
       <xsd:documentation>Left Indentation in Character Units</xsd:documentation>
     </xsd:annotation>
   </xsd:attribute>
   <xsd:attribute name="rightChars" type="ST_DecimalNumber" use="optional">
     <xsd:annotation>
       <xsd:documentation>Right Indentation in Character Units</xsd:documentation>
     </xsd:annotation>
   </xsd:attribute>
   <xsd:attribute name="hangingChars" type="ST_DecimalNumber" use="optional">
     <xsd:annotation>
       <xsd:documentation>Indentation Removed From First Line in Character Units</xsd:documentation>
     </xsd:annotation>
   </xsd:attribute>
   <xsd:attribute name="firstLineChars" type="ST_DecimalNumber" use="optional">
     <xsd:annotation>
       <xsd:documentation>Additional First Line Indentation in Character Units</xsd:documentation>
     </xsd:annotation>
   </xsd:attribute>
 </xsd:complexType>

UOF support

  • Line Spacing In Line Units. (Part of schema)

[xml]

  <xsd:element name="段间距" minOccurs="0">
       <xsd:annotation>
               <xsd:documentation>Line Spacing</xsd:documentation>
       </xsd:annotation>
       <xsd:complexType>
               <xsd:all>
                       <xsd:element name="段前距" minOccurs="0">
                               <xsd:annotation>
                                       <xsd:documentation>Line Spacing Above Paragraph</xsd:documentation>
                               </xsd:annotation>
                               <xsd:complexType>
                                       <xsd:choice>
                                               <xsd:element name="相对值">
                                                       <xsd:annotation>
                                                               <xsd:documentation> Spacing Above Paragraph In Relative Value</xsd:documentation>
                                                       </xsd:annotation>
                                                       <xsd:complexType>
                                                               <xsd:attribute ref="uof:locID" use="required" fixed="t0200"/>
                                                               <xsd:attribute name="值" type="xsd:float" use="required"/>
                                                               <xsd:attribute ref="uof:attrList" use="required" fixed="值"/>
                                                       </xsd:complexType>
                                               </xsd:element>
                                       </xsd:choice>
                                       <xsd:attribute ref="uof:locID" use="required" fixed="t0196"/>
                               </xsd:complexType>
                       </xsd:element>
                       <xsd:element name="段后距" minOccurs="0">
                               <xsd:annotation>
                                       <xsd:documentation>Line Spacing Below Paragraph</xsd:documentation>
                               </xsd:annotation>
                               <xsd:complexType>
                                       <xsd:choice>
                                               <xsd:element name="相对值">
                                                       <xsd:annotation>
                                                               <xsd:documentation> Spacing Below Paragraph In Relative Value</xsd:documentation>
                                                       </xsd:annotation>
                                                       <xsd:complexType>
                                                               <xsd:attribute ref="uof:locID" use="required" fixed="t0203"/>
                                                               <xsd:attribute name="值" type="xsd:float" use="required"/>
                                                               <xsd:attribute ref="uof:attrList" use="required" fixed="值"/>
                                                       </xsd:complexType>
                                               </xsd:element>
                                       </xsd:choice>
                                       <xsd:attribute ref="uof:locID" use="required" fixed="t0197"/>
                               </xsd:complexType>
                       </xsd:element>
               </xsd:all>
               <xsd:attribute ref="uof:locID" use="required" fixed="t0058"/>
       </xsd:complexType>
    </xsd:element>


  • Indentation In Character Units (Part of schema)

[xml] <xsd:complexType name="缩进类型">

       <xsd:annotation>
               <xsd:documentation>Indentation of Paragraph</xsd:documentation>
       </xsd:annotation>
       <xsd:all>
               <xsd:element name="左" minOccurs="0">
                       <xsd:annotation>
                               <xsd:documentation>Left Indentation</xsd:documentation>
                       </xsd:annotation>
                       <xsd:complexType>
                               <xsd:choice>
                                       <xsd:element name="相对">
                                               <xsd:annotation>
                                                       <xsd:documentation>Left Indentation In Relative Value</xsd:documentation>
                                               </xsd:annotation>
                                               <xsd:complexType>
                                                       <xsd:attribute name="值" type="xsd:float" use="required"/>
                                                       <xsd:attribute ref="uof:locID" use="required" fixed="t0186"/>
                                                       <xsd:attribute ref="uof:attrList" use="required" fixed="值"/>
                                               </xsd:complexType>
                                       </xsd:element>
                               </xsd:choice>
                               <xsd:attribute ref="uof:locID" use="required" fixed="t0182"/>
                       </xsd:complexType>
               </xsd:element>
               <xsd:element name="右" minOccurs="0">
                       <xsd:annotation>
                               <xsd:documentation>Right Indentation</xsd:documentation>
                       </xsd:annotation>
                       <xsd:complexType>
                               <xsd:choice>
                                       <xsd:element name="相对">
                                               <xsd:annotation>
                                                       <xsd:documentation>Right Indentation In Relative Value</xsd:documentation>
                                               </xsd:annotation>
                                               <xsd:complexType>
                                                       <xsd:attribute name="值" type="xsd:float" use="required"/>
                                                       <xsd:attribute ref="uof:locID" use="required" fixed="t0188"/>
                                                       <xsd:attribute ref="uof:attrList" use="required" fixed="值"/>
                                               </xsd:complexType>
                                       </xsd:element>
                               </xsd:choice>
                               <xsd:attribute ref="uof:locID" use="required" fixed="t0183"/>
                       </xsd:complexType>
               </xsd:element>
               <xsd:element name="首行" minOccurs="0">
                       <xsd:annotation>
                               <xsd:documentation> First Line Indentation </xsd:documentation>
                       </xsd:annotation>
                       <xsd:complexType>
                               <xsd:choice>
                                       <xsd:element name="相对">
                                               <xsd:annotation>
                                                       <xsd:documentation> First Line Indentation In Relative Value </xsd:documentation>
                                               </xsd:annotation>
                                               <xsd:complexType>
                                                       <xsd:attribute name="值" type="xsd:float" use="required"/>
                                                       <xsd:attribute ref="uof:locID" use="required" fixed="t0190"/>
                                                       <xsd:attribute ref="uof:attrList" use="required" fixed="值"/>
                                               </xsd:complexType>
                                       </xsd:element>
                               </xsd:choice>
                               <xsd:attribute ref="uof:locID" use="required" fixed="t0184"/>
                       </xsd:complexType>
               </xsd:element>
       </xsd:all>

</xsd:complexType>


Cite error: <ref> tags exist, but no <references/> tag was found

Personal tools