<font-name>Symbol</font-name>
<class-name>Symbol</class-name>
<encoding>SymbolEncoding</encoding>
- <cap-height>1010</cap-height>
+ <cap-height>1010</cap-height>
<x-height>520</x-height>
<ascender>1010</ascender>
<descender>-293</descender>
<font-name>ZapfDingbats</font-name>
<class-name>ZapfDingbats</class-name>
<encoding>ZapfDingbatsEncoding</encoding>
- <cap-height>820</cap-height>
+ <cap-height>820</cap-height>
<x-height>426</x-height>
<ascender>820</ascender>
<descender>-143</descender>
<map adobe-name="a189" win-ansi="0x00FC" unicode="0x27BC" unicodeName="WEDGE-TAILED RIGHTWARDS ARROW"/>
<map adobe-name="a190" win-ansi="0x00FD" unicode="0x27BD" unicodeName="HEAVY WEDGE-TAILED RIGHTWARDS ARROW"/>
<map adobe-name="a191" win-ansi="0x00FE" unicode="0x27BE" unicodeName="OPEN-OUTLINED RIGHTWARDS ARROW"/>
- <!-- the following mappings are used for the Symbol font
+ <!-- the following mappings are used for the Symbol font
TBD: remove doublettes -->
<map adobe-name="universal" win-ansi="0x22" unicode="0x2200"/>
<map adobe-name="existential" win-ansi="0x24" unicode="0x2203"/>
</font-mappings>
<!-- I couldn't find the following characters in the unicode tables -->
<!--
- <map adobe-name="center" win-ansi="-1" unicode=""/>
- <map adobe-name="dectab" win-ansi="-1" unicode=""/>
- <map adobe-name="down" win-ansi="-1" unicode=""/>
- <map adobe-name="format" win-ansi="-1" unicode=""/>
- <map adobe-name="graybox" win-ansi="-1" unicode=""/>
- <map adobe-name="indent" win-ansi="-1" unicode=""/>
- <map adobe-name="largebullet" win-ansi="-1" unicode=""/>
- <map adobe-name="left" win-ansi="-1" unicode=""/>
- <map adobe-name="ll" win-ansi="-1" unicode=""/>
- <map adobe-name="LL" win-ansi="-1" unicode=""/>
- <map adobe-name="merge" win-ansi="-1" unicode=""/>
- <map adobe-name="notegraphic" win-ansi="-1" unicode=""/>
- <map adobe-name="overscore" win-ansi="-1" unicode=""/>
- <map adobe-name="prescription" win-ansi="-1" unicode=""/>
- <map adobe-name="return" win-ansi="-1" unicode=""/>
+ <map adobe-name="center" win-ansi="-1" unicode=""/>
+ <map adobe-name="dectab" win-ansi="-1" unicode=""/>
+ <map adobe-name="down" win-ansi="-1" unicode=""/>
+ <map adobe-name="format" win-ansi="-1" unicode=""/>
+ <map adobe-name="graybox" win-ansi="-1" unicode=""/>
+ <map adobe-name="indent" win-ansi="-1" unicode=""/>
+ <map adobe-name="largebullet" win-ansi="-1" unicode=""/>
+ <map adobe-name="left" win-ansi="-1" unicode=""/>
+ <map adobe-name="ll" win-ansi="-1" unicode=""/>
+ <map adobe-name="LL" win-ansi="-1" unicode=""/>
+ <map adobe-name="merge" win-ansi="-1" unicode=""/>
+ <map adobe-name="notegraphic" win-ansi="-1" unicode=""/>
+ <map adobe-name="overscore" win-ansi="-1" unicode=""/>
+ <map adobe-name="prescription" win-ansi="-1" unicode=""/>
+ <map adobe-name="return" win-ansi="-1" unicode=""/>
<map adobe-name="square" win-ansi="-1" unicode=""/>
<map adobe-name="stop" win-ansi="-1" unicode=""/>
<map adobe-name="tab" win-ansi="-1" unicode=""/>
</xsl:choose>
</xsl:variable>
<xsl:variable name="bEnum">
- <xsl:call-template name="hasEnum"/>
+ <xsl:call-template name="hasEnum"/>
</xsl:variable>
<xsl:variable name="bSubpropEnum">
- <xsl:call-template name="hasSubpropEnum"/>
+ <xsl:call-template name="hasSubpropEnum"/>
</xsl:variable>
<xsl:if test="$bEnum='true' or contains($bSubpropEnum, 'true')">
<!-- Handle enumeration values -->
public interface <xsl:value-of select="$classname"/>
<xsl:if test="use-generic and $bEnum='true'">
- extends <xsl:value-of select="use-generic"/>.Enums
+ extends <xsl:value-of select="use-generic"/>.Enums
</xsl:if>{
<xsl:for-each select="enumeration/value">
public final static int <xsl:value-of select="@const"/> = Constants.<xsl:value-of select="@const"/>;
</xsl:call-template>
</xsl:when>
<xsl:when test="$prop/compound/subproperty/use-generic">
- <!-- generate "interface <subprop> extends <gensubprop>.Enums" -->
- <xsl:for-each select="$prop/compound/subproperty[use-generic]">
- <xsl:variable name="bSpEnum">
- <xsl:call-template name="hasEnum">
- <xsl:with-param name="prop"
- select="key('genericref', use-generic)"/>
+ <!-- generate "interface <subprop> extends <gensubprop>.Enums" -->
+ <xsl:for-each select="$prop/compound/subproperty[use-generic]">
+ <xsl:variable name="bSpEnum">
+ <xsl:call-template name="hasEnum">
+ <xsl:with-param name="prop"
+ select="key('genericref', use-generic)"/>
</xsl:call-template>
- </xsl:variable>
- <xsl:if test="$bSpEnum='true'">
- public interface <xsl:value-of select="name"/> extends <xsl:value-of select="use-generic"/>.Enums { }
- </xsl:if>
- </xsl:for-each>
+ </xsl:variable>
+ <xsl:if test="$bSpEnum='true'">
+ public interface <xsl:value-of select="name"/> extends <xsl:value-of select="use-generic"/>.Enums { }
+ </xsl:if>
+ </xsl:for-each>
</xsl:when>
<xsl:otherwise>false</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
- <!-- generate "interface <subprop> extends <genprop>.<subprop>" -->
+ <!-- generate "interface <subprop> extends <genprop>.<subprop>" -->
<xsl:for-each select="$prop/compound/subproperty[enumeration]">
<xsl:variable name="spname">
<xsl:call-template name="makeClassName">
public interface <xsl:value-of select="$spname"/> extends <xsl:value-of select="$generic_name"/>.Enums.<xsl:value-of select="$spname"/> {
}
</xsl:for-each>
-
+
<xsl:if test="$prop/use-generic">
<xsl:call-template name="inhspenums">
<xsl:with-param name="prop" select="key('genericref', $prop/use-generic)"/>
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
-
+
<xsl:param name="encoding" select="/font-metrics/encoding"/>
<xsl:variable name="native-encoding" select="/font-metrics/encoding"/>
<xsl:variable name="glyphs" select="document('encodings.xml')/encoding-set/encoding[@id=$encoding]/glyph"/>
public String encoding() {
return encoding;
}
-
+
public String fontName() {
return fontName;
}
public char mapChar(char c) {
char d = mapping.mapChar(c);
- if(d != 0)
+ if(d != 0)
return d;
else
- return '#';
+ return '#';
}
}
<?xml version="1.0" standalone="yes" ?>
<property-list family="FO">
<generic-property-list>
- <property type="generic">
- <name>generic-color</name>
- <class-name>GenericColor</class-name>
- <datatype>ColorType</datatype>
- <extfile href="colorkw.xml"/>
+ <property type="generic">
+ <name>generic-color</name>
+ <class-name>GenericColor</class-name>
+ <datatype>ColorType</datatype>
+ <extfile href="colorkw.xml"/>
<!--
- <datatype-conversion from-type="String" varname="strval">
- new ColorType(strval)</datatype-conversion>
+ <datatype-conversion from-type="String" varname="strval">
+ new ColorType(strval)</datatype-conversion>
-->
- </property>
- <property type="generic">
- <name>generic-boolean</name>
- <class-name>GenericBoolean</class-name>
- <datatype>Enum</datatype>
- <enumeration>
- <value const="TRUE">true</value>
- <value const="FALSE">false</value>
- </enumeration>
- </property>
- <property type="generic">
- <name>generic-keep</name>
- <class-name>GenericKeep</class-name>
- <datatype>Keep</datatype> <!-- CompoundDatatype -->
- <compound>
- <subproperty set-by-shorthand="true">
- <name>within-page</name>
- <datatype>Number</datatype>
- <default>auto</default>
- <enumeration>
- <value const="AUTO">auto</value>
- <value const="ALWAYS">always</value>
- </enumeration>
- </subproperty>
- <subproperty set-by-shorthand="true">
- <name>within-line</name>
- <datatype>Number</datatype>
- <default>auto</default>
- <enumeration>
- <value const="AUTO">auto</value>
- <value const="ALWAYS">always</value>
- </enumeration>
- </subproperty>
- <subproperty set-by-shorthand="true">
- <name>within-column</name>
- <datatype>Number</datatype>
- <default>auto</default>
- <enumeration>
- <value const="AUTO">auto</value>
- <value const="ALWAYS">always</value>
- </enumeration>
- </subproperty>
- </compound>
- </property>
- <property type="generic">
- <name>conditional-length-template</name>
- <class-name>GenericCondLength</class-name>
- <datatype>CondLength</datatype>
- <compound>
- <subproperty set-by-shorthand="true">
- <name>length</name>
- <datatype>Length</datatype>
- </subproperty>
- <subproperty>
- <name>conditionality</name>
- <datatype>Enum</datatype>
- <enumeration>
- <value const="DISCARD">discard</value>
- <value const="RETAIN">retain</value>
- </enumeration>
- </subproperty>
- </compound>
- </property>
- <property type="generic">
- <name>padding-template</name>
- <class-name>GenericCondPadding</class-name>
- <use-generic>GenericCondLength</use-generic>
- <inherited>false</inherited>
- <default subproperty="length">0pt</default>
- </property>
- <property type="generic">
- <name>padding-template</name>
- <class-name>GenericPadding</class-name>
- <datatype>Length</datatype>
- <inherited>false</inherited>
- <default>0pt</default>
+ </property>
+ <property type="generic">
+ <name>generic-boolean</name>
+ <class-name>GenericBoolean</class-name>
+ <datatype>Enum</datatype>
+ <enumeration>
+ <value const="TRUE">true</value>
+ <value const="FALSE">false</value>
+ </enumeration>
+ </property>
+ <property type="generic">
+ <name>generic-keep</name>
+ <class-name>GenericKeep</class-name>
+ <datatype>Keep</datatype> <!-- CompoundDatatype -->
+ <compound>
+ <subproperty set-by-shorthand="true">
+ <name>within-page</name>
+ <datatype>Number</datatype>
+ <default>auto</default>
+ <enumeration>
+ <value const="AUTO">auto</value>
+ <value const="ALWAYS">always</value>
+ </enumeration>
+ </subproperty>
+ <subproperty set-by-shorthand="true">
+ <name>within-line</name>
+ <datatype>Number</datatype>
+ <default>auto</default>
+ <enumeration>
+ <value const="AUTO">auto</value>
+ <value const="ALWAYS">always</value>
+ </enumeration>
+ </subproperty>
+ <subproperty set-by-shorthand="true">
+ <name>within-column</name>
+ <datatype>Number</datatype>
+ <default>auto</default>
+ <enumeration>
+ <value const="AUTO">auto</value>
+ <value const="ALWAYS">always</value>
+ </enumeration>
+ </subproperty>
+ </compound>
+ </property>
+ <property type="generic">
+ <name>conditional-length-template</name>
+ <class-name>GenericCondLength</class-name>
+ <datatype>CondLength</datatype>
+ <compound>
+ <subproperty set-by-shorthand="true">
+ <name>length</name>
+ <datatype>Length</datatype>
+ </subproperty>
+ <subproperty>
+ <name>conditionality</name>
+ <datatype>Enum</datatype>
+ <enumeration>
+ <value const="DISCARD">discard</value>
+ <value const="RETAIN">retain</value>
+ </enumeration>
+ </subproperty>
+ </compound>
+ </property>
+ <property type="generic">
+ <name>padding-template</name>
+ <class-name>GenericCondPadding</class-name>
+ <use-generic>GenericCondLength</use-generic>
+ <inherited>false</inherited>
+ <default subproperty="length">0pt</default>
+ </property>
+ <property type="generic">
+ <name>padding-template</name>
+ <class-name>GenericPadding</class-name>
+ <datatype>Length</datatype>
+ <inherited>false</inherited>
+ <default>0pt</default>
<shorthand>padding</shorthand>
- </property>
+ </property>
<!-- Before, After, Start, End border width props -->
<!-- CondLength, but adds keyword values both to the "shorthand" setting
- and to the length component. So we redefine the components here,
- rather than doing a "use-generic" on GenericCondLength.
+ and to the length component. So we redefine the components here,
+ rather than doing a "use-generic" on GenericCondLength.
-->
- <property type="generic">
- <name>border-cond-width-template</name>
- <class-name>GenericCondBorderWidth</class-name>
- <keyword-equiv match="thin">0.5pt</keyword-equiv>
- <keyword-equiv match="medium">1pt</keyword-equiv>
- <keyword-equiv match="thick">2pt</keyword-equiv>
- <inherited>false</inherited>
- <datatype>CondLength</datatype>
- <compound>
- <subproperty set-by-shorthand="true">
- <name>length</name>
- <datatype>Length</datatype>
- <keyword-equiv match="thin">0.5pt</keyword-equiv>
- <keyword-equiv match="medium">1pt</keyword-equiv>
- <keyword-equiv match="thick">2pt</keyword-equiv>
- <default>medium</default>
- </subproperty>
- <subproperty>
- <datatype>Enum</datatype>
- <name>conditionality</name>
- <enumeration>
- <value const="DISCARD">discard</value>
- <value const="RETAIN">retain</value>
- </enumeration>
- </subproperty>
- </compound>
- </property>
+ <property type="generic">
+ <name>border-cond-width-template</name>
+ <class-name>GenericCondBorderWidth</class-name>
+ <keyword-equiv match="thin">0.5pt</keyword-equiv>
+ <keyword-equiv match="medium">1pt</keyword-equiv>
+ <keyword-equiv match="thick">2pt</keyword-equiv>
+ <inherited>false</inherited>
+ <datatype>CondLength</datatype>
+ <compound>
+ <subproperty set-by-shorthand="true">
+ <name>length</name>
+ <datatype>Length</datatype>
+ <keyword-equiv match="thin">0.5pt</keyword-equiv>
+ <keyword-equiv match="medium">1pt</keyword-equiv>
+ <keyword-equiv match="thick">2pt</keyword-equiv>
+ <default>medium</default>
+ </subproperty>
+ <subproperty>
+ <datatype>Enum</datatype>
+ <name>conditionality</name>
+ <enumeration>
+ <value const="DISCARD">discard</value>
+ <value const="RETAIN">retain</value>
+ </enumeration>
+ </subproperty>
+ </compound>
+ </property>
<!-- Left, Right, Top, Bottom borderwidth props -->
- <property type="generic">
- <name>border-width-template</name>
- <class-name>GenericBorderWidth</class-name>
- <datatype>Length</datatype>
- <keyword-equiv match="thin">0.5pt</keyword-equiv>
- <keyword-equiv match="medium">1pt</keyword-equiv>
- <keyword-equiv match="thick">2pt</keyword-equiv>
- <inherited>false</inherited>
- <default>0pt</default>
- <shorthand>border-width</shorthand>
- </property>
- <property type="generic">
- <name>border-style-template</name>
- <class-name>GenericBorderStyle</class-name>
- <inherited>false</inherited>
- <datatype>Enum</datatype>
- <enumeration>
- <value const="NONE">none</value>
- <value const="HIDDEN">hidden</value>
- <value const="DOTTED">dotted</value>
- <value const="DASHED">dashed</value>
- <value const="SOLID">solid</value>
- <value const="DOUBLE">double</value>
- <value const="GROOVE">groove</value>
- <value const="RIDGE">ridge</value>
- <value const="INSET">inset</value>
- <value const="OUTSET">outset</value>
- </enumeration>
- <default>none</default>
- <shorthand>border-style</shorthand>
- </property>
- <property type="generic">
- <name>break-template</name>
- <class-name>GenericBreak</class-name>
- <inherited>false</inherited>
- <datatype>Enum</datatype>
- <enumeration>
- <value const="AUTO">auto</value>
- <value const="COLUMN">column</value>
- <value const="PAGE">page</value>
- <value const="EVEN_PAGE">even-page</value>
- <value const="ODD_PAGE">odd-page</value>
- </enumeration>
- <default>auto</default>
- </property>
- <property type="generic">
- <name>generic-space</name>
- <class-name>GenericSpace</class-name>
- <inherited>false</inherited>
- <datatype>Space</datatype>
- <compound>
- <subproperty set-by-shorthand="true">
- <name>minimum</name>
- <datatype>Length</datatype>
- <default>0pt</default>
- </subproperty>
- <subproperty set-by-shorthand="true">
- <name>optimum</name>
- <datatype>Length</datatype>
- <default>0pt</default>
- </subproperty>
- <subproperty set-by-shorthand="true">
- <name>maximum</name>
- <datatype>Length</datatype>
- <default>0pt</default>
- </subproperty>
- <subproperty>
- <name>precedence</name>
- <datatype>Number</datatype>
- <enumeration>
- <value const="FORCE">force</value>
- </enumeration>
- <default>0</default>
- </subproperty>
- <subproperty>
- <name>conditionality</name>
- <datatype>Enum</datatype>
- <enumeration>
- <value const="DISCARD">discard</value>
- <value const="RETAIN">retain</value>
- </enumeration>
- <default>discard</default>
- </subproperty>
- </compound>
- </property>
+ <property type="generic">
+ <name>border-width-template</name>
+ <class-name>GenericBorderWidth</class-name>
+ <datatype>Length</datatype>
+ <keyword-equiv match="thin">0.5pt</keyword-equiv>
+ <keyword-equiv match="medium">1pt</keyword-equiv>
+ <keyword-equiv match="thick">2pt</keyword-equiv>
+ <inherited>false</inherited>
+ <default>0pt</default>
+ <shorthand>border-width</shorthand>
+ </property>
+ <property type="generic">
+ <name>border-style-template</name>
+ <class-name>GenericBorderStyle</class-name>
+ <inherited>false</inherited>
+ <datatype>Enum</datatype>
+ <enumeration>
+ <value const="NONE">none</value>
+ <value const="HIDDEN">hidden</value>
+ <value const="DOTTED">dotted</value>
+ <value const="DASHED">dashed</value>
+ <value const="SOLID">solid</value>
+ <value const="DOUBLE">double</value>
+ <value const="GROOVE">groove</value>
+ <value const="RIDGE">ridge</value>
+ <value const="INSET">inset</value>
+ <value const="OUTSET">outset</value>
+ </enumeration>
+ <default>none</default>
+ <shorthand>border-style</shorthand>
+ </property>
+ <property type="generic">
+ <name>break-template</name>
+ <class-name>GenericBreak</class-name>
+ <inherited>false</inherited>
+ <datatype>Enum</datatype>
+ <enumeration>
+ <value const="AUTO">auto</value>
+ <value const="COLUMN">column</value>
+ <value const="PAGE">page</value>
+ <value const="EVEN_PAGE">even-page</value>
+ <value const="ODD_PAGE">odd-page</value>
+ </enumeration>
+ <default>auto</default>
+ </property>
+ <property type="generic">
+ <name>generic-space</name>
+ <class-name>GenericSpace</class-name>
+ <inherited>false</inherited>
+ <datatype>Space</datatype>
+ <compound>
+ <subproperty set-by-shorthand="true">
+ <name>minimum</name>
+ <datatype>Length</datatype>
+ <default>0pt</default>
+ </subproperty>
+ <subproperty set-by-shorthand="true">
+ <name>optimum</name>
+ <datatype>Length</datatype>
+ <default>0pt</default>
+ </subproperty>
+ <subproperty set-by-shorthand="true">
+ <name>maximum</name>
+ <datatype>Length</datatype>
+ <default>0pt</default>
+ </subproperty>
+ <subproperty>
+ <name>precedence</name>
+ <datatype>Number</datatype>
+ <enumeration>
+ <value const="FORCE">force</value>
+ </enumeration>
+ <default>0</default>
+ </subproperty>
+ <subproperty>
+ <name>conditionality</name>
+ <datatype>Enum</datatype>
+ <enumeration>
+ <value const="DISCARD">discard</value>
+ <value const="RETAIN">retain</value>
+ </enumeration>
+ <default>discard</default>
+ </subproperty>
+ </compound>
+ </property>
<!-- Common Accessibility Properties -->
DTD for foproperties.xml and svgproperties.xml
-->
-<!DOCTYPE property-list [
+<!DOCTYPE property-list [
<!ELEMENT property-list (generic-property-list?, element-property-list*) >
-
+
<!-- This defines properties which are generic: meaning they are valid for
any formatting object in the namespace associated with this properties
file.
-->
<!ELEMENT generic-property-list (property+) >
-
+
<!-- This defines properties which are specific to a particular element.
The elements are specified in one or more localname elements. This
will generate code which can be used to set up element-specific
-->
<!ELEMENT element-property-list (localname+, property+) >
<!ELEMENT localname (#PCDATA) >
-
+
<!-- Define a single property in the current namespace -->
<!ELEMENT property (name, (use-generic | datatype), class-name?, inherited?,
- default?, enumeration?, datatype-conversion*, compound?,
- keyword-equiv*, percent-ok?, auto-ok?, derive?, corresponding? ) >
-
+ default?, enumeration?, datatype-conversion*, compound?,
+ keyword-equiv*, percent-ok?, auto-ok?, derive?, corresponding? ) >
+
<!-- If type is set to "ref", then this is not a new property definition,
but rather a reference to a property allready defined (should be in
another namespace). The "family" attribute then indicates in which
<!-- Sub-elements of property. -->
<!-- This gives the name of the attribute used to specify values for this
property in input FO or SVG files. It MUST be specified.
--->
+-->
<!ELEMENT name (#PCDATA) >
-
+
<!-- This gives the class name of the Java class which will be created to
represent values for this property. It doesn't need to be specified if
it can be deduced from the "name". The rule is that the first letter
of the property name and any name following a "-" are capitalized and
the "-" characters are removed. If you want to force a name, use the
class-name sub-element.
--->
+-->
<!ELEMENT class-name (#PCDATA) >
-
+
<!-- This indicates that this property is based on a generic property
datatype. This may be one hand-coded, such as SVGLengthProperty, or it
may be one which is created by a generic property definition in the
only used for the SVG properties, because they don't have a
rule-based relationship between the actual Property class name
and the name of the datatype stored by objects of that class.
--->
+-->
<!ELEMENT use-generic (#PCDATA) >
<!ATTLIST use-generic
- ispropclass (true | false ) "false"
+ ispropclass (true | false ) "false"
>
<!-- This indicates whether the property is inherited or not. Use the value
value of the property is inherited. An example is line-height, which
if specified using relative units or a percent, is recalculated
relative to the FONTSIZE of the current FO.
--->
+-->
<!ELEMENT inherited (#PCDATA) >
<!ATTLIST inherited
- type (specified | computed) "computed"
+ type (specified | computed) "computed"
>
-
+
<!-- This gives the datatype of the stored property values. It shouldn't be
specified if the property has a use-generic element. The value of this
element should be the name of either a basic Java class (String,
NOTE: the value "Enum" is special and indicates an enumerated
datatype, stored as a Java "int". There is an EnumProperty class, but
no corresponding Enum class.
--->
+-->
<!ELEMENT datatype (#PCDATA) >
<!-- This element is used to specify the allowable values for enumerated
each value is used to generate a public static constant value in the
class which can be referenced in code to test the property value. It
must be a legal Java identifier. By convention, use all caps.
--->
+-->
<!ELEMENT enumeration (value+) >
<!ELEMENT value (#PCDATA) >
-<!ATTLIST value
- const CDATA #REQUIRED
+<!ATTLIST value
+ const CDATA #REQUIRED
>
-
+
<!-- This gives the default value for a property if it is not specified on
a given FO. (The spec calls this the "initial" value.)
for a particular component. For example, the border-end-width property
is based on GenericCondBorderWidth and specifies a specific default
for the "conditionality" component.
--->
+-->
<!ELEMENT default (#PCDATA) >
<!ATTLIST default
- contextdep (true | false) "false"
- subproperty CDATA #IMPLIED
+ contextdep (true | false) "false"
+ subproperty CDATA #IMPLIED
>
-
+
<!-- The datatype-conversion element(s) specify how to handle property
values which can be specified in several ways. For example, the
An example is space-before.
-->
<!ELEMENT compound (subproperty+) >
-
+
<!-- Describe one component of a compound property. Only the name and the
datatype should be specified. For example, in the space-before
property, the optimum component has the name optimum and the datatype
-->
<!ELEMENT keyword-equiv (#PCDATA) >
<!ATTLIST keyword-equiv
- match CDATA #REQUIRED
- eval (true|false) "true"
+ match CDATA #REQUIRED
+ eval (true|false) "true"
>
<!-- This element if present indicates that percent specifications are
-->
<!ELEMENT percent-ok (#PCDATA) >
<!ATTLIST percent-ok
- base (FONTSIZE | INH-FONTSIZE | CONTAINING-BOX) #IMPLIED
+ base (FONTSIZE | INH-FONTSIZE | CONTAINING-BOX) #IMPLIED
>
<!-- This element if present indicates that a value of "auto" for a Length
is created which holds a Length object of type "AUTO".
-->
<!ELEMENT auto-ok EMPTY >
-
+
<!-- This element if present indicates that the value of the property may
be computed (derived) from other properties if it isn't specified. It
assumes that the property is an Enum datatype. (Currently only used
-->
<!ELEMENT derive (if+) >
<!ATTLIST derive
- from CDATA #REQUIRED
+ from CDATA #REQUIRED
>
<!ELEMENT if (#PCDATA) >
<!ATTLIST if
- match CDATA #REQUIRED
+ match CDATA #REQUIRED
>
<!-- This element indicates that the value of the property is the same as
<!ELEMENT propval (wmrel2abs | wmabs2rel | #PCDATA)+ >
<!ELEMENT wmrel2abs EMPTY>
-<!ATTLIST wmrel2abs
+<!ATTLIST wmrel2abs
dir (BEFORE | AFTER | START | END | BLOCKPROGDIM | INLINEPROGDIM)
#REQUIRED
>
public PercentBase getPercentBase(final FObj fo, final PropertyList propertyList) {
<xsl:choose>
<xsl:when test="@base">
- return new LengthBase(fo, propertyList, LengthBase.<xsl:value-of select="@base"/>);
+ return new LengthBase(fo, propertyList, LengthBase.<xsl:value-of select="@base"/>);
</xsl:when>
<xsl:otherwise>
- return (new LengthBase(fo, propertyList, LengthBase.CUSTOM_BASE ) {
- public int getBaseLength() {
- return (<xsl:value-of select="."/>);
+ return (new LengthBase(fo, propertyList, LengthBase.CUSTOM_BASE ) {
+ public int getBaseLength() {
+ return (<xsl:value-of select="."/>);
}
- });
+ });
</xsl:otherwise>
</xsl:choose>
}
<xsl:with-param name="specvals" select="concat(.,' ')"/>
</xsl:call-template>
</xsl:for-each>
- return super.checkEnumValues(value);
+ return super.checkEnumValues(value);
}
</xsl:template>
// Initialize hashtable of keywords
static HashMap s_htKeywords;
static {
- s_htKeywords = new HashMap(<xsl:value-of select="count(../keyword-equiv)"/>);
+ s_htKeywords = new HashMap(<xsl:value-of select="count(../keyword-equiv)"/>);
<xsl:for-each select="../keyword-equiv">
- s_htKeywords.put("<xsl:value-of select="@match"/>", "<xsl:value-of select="."/>");
+ s_htKeywords.put("<xsl:value-of select="@match"/>", "<xsl:value-of select="."/>");
</xsl:for-each>
}
protected String checkValueKeywords(String keyword) {
String value = (String)s_htKeywords.get(keyword);
if (value == null) {
- return super.checkValueKeywords(keyword);
+ return super.checkValueKeywords(keyword);
}
else return value;
}
<xsl:when test="../compound">
<xsl:call-template name="propclass">
<xsl:with-param name="prop"
- select="../compound/subproperty[@set-by-shorthand]"/>
+ select="../compound/subproperty[@set-by-shorthand]"/>
</xsl:call-template>
</xsl:when><xsl:otherwise>
<xsl:call-template name="propclass">
</xsl:variable>
// See if other value types are acceptable
protected Property convertPropertyDatatype(Property p,
- PropertyList propertyList, FObj fo) {
+ PropertyList propertyList, FObj fo) {
<xsl:for-each select="../datatype-conversion">
{
<xsl:variable name="dtc">
<xsl:choose>
- <xsl:when test="@vartype">
- <xsl:value-of select="@vartype"/>
- </xsl:when><xsl:otherwise>
- <xsl:value-of select="@from-type"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:value-of select="$dtc"/><xsl:text> </xsl:text> <xsl:value-of select="@varname"/> =
- p.get<xsl:value-of select="@from-type"/>();
- if (<xsl:value-of select="@varname"/> != null) {
- return new <xsl:value-of select="$propclass"/>(
- <xsl:value-of select='.'/>);
+ <xsl:when test="@vartype">
+ <xsl:value-of select="@vartype"/>
+ </xsl:when><xsl:otherwise>
+ <xsl:value-of select="@from-type"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="$dtc"/><xsl:text> </xsl:text> <xsl:value-of select="@varname"/> =
+ p.get<xsl:value-of select="@from-type"/>();
+ if (<xsl:value-of select="@varname"/> != null) {
+ return new <xsl:value-of select="$propclass"/>(
+ <xsl:value-of select='.'/>);
}
}
</xsl:for-each>
<!-- generate getDefaultForXXX for property components -->
<xsl:template match="default[@subproperty]" priority="2">
<xsl:variable name="spname">
- <xsl:call-template name="makeClassName">
- <xsl:with-param name="propstr" select="@subproperty"/>
- </xsl:call-template>
+ <xsl:call-template name="makeClassName">
+ <xsl:with-param name="propstr" select="@subproperty"/>
+ </xsl:call-template>
</xsl:variable>
protected String getDefaultFor<xsl:value-of select='$spname'/>() {
- return "<xsl:value-of select='.'/>";
+ return "<xsl:value-of select='.'/>";
}
</xsl:template>
public Property make(PropertyList propertyList) throws FOPException {
<xsl:choose><xsl:when test='@contextdep="true"'>
return make(propertyList, "<xsl:value-of select='.'/>", propertyList.getParentFObj());
- </xsl:when><xsl:otherwise>
+ </xsl:when><xsl:otherwise>
if (m_defaultProp == null) {
m_defaultProp=make(propertyList, "<xsl:value-of select='.'/>", propertyList.getParentFObj());
- }
+ }
return m_defaultProp;
- </xsl:otherwise></xsl:choose>
+ </xsl:otherwise></xsl:choose>
}
</xsl:template>
</xsl:for-each>
<xsl:for-each select="compound/subproperty[enumeration]">
<xsl:variable name="spname">
- <xsl:call-template name="makeClassName">
+ <xsl:call-template name="makeClassName">
<xsl:with-param name="propstr" select="name"/>
</xsl:call-template>
</xsl:variable>
</xsl:variable>
<xsl:for-each select="compound/subproperty">
<xsl:variable name="spname">
- <xsl:call-template name="makeClassName">
+ <xsl:call-template name="makeClassName">
<xsl:with-param name="propstr" select="name"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test='*[local-name(.)!="name" and local-name(.)!="datatype" and local-name(.)!="use-generic" and local-name(.)!="default"]'>
static private class SP_<xsl:value-of select="$spname"/>Maker
- extends <xsl:value-of select="$sp_superclass"/>
+ extends <xsl:value-of select="$sp_superclass"/>
<xsl:if test="enumeration"> implements <xsl:value-of select="$enumclass"/>.<xsl:value-of select="$spname"/></xsl:if> {
- SP_<xsl:value-of select="$spname"/>Maker(String sPropName) {
- super(sPropName);
+ SP_<xsl:value-of select="$spname"/>Maker(String sPropName) {
+ super(sPropName);
}
<xsl:for-each select="enumeration/value">
protected final static EnumProperty s_prop<xsl:value-of select="@const"/> = new EnumProperty(<xsl:value-of select="@const"/>);
</xsl:for-each>
- <xsl:apply-templates select="percent-ok|auto-ok|keyword-equiv|datatype-conversion|enumeration"/>
+ <xsl:apply-templates select="percent-ok|auto-ok|keyword-equiv|datatype-conversion|enumeration"/>
}
final private static Property.Maker s_<xsl:value-of select="$spname"/>Maker =
- new SP_<xsl:value-of select="$spname"/>Maker(
- "<xsl:value-of select='../../name'/>.<xsl:value-of select='name'/>");
+ new SP_<xsl:value-of select="$spname"/>Maker(
+ "<xsl:value-of select='../../name'/>.<xsl:value-of select='name'/>");
</xsl:when>
<xsl:otherwise>
final private static Property.Maker s_<xsl:value-of select="$spname"/>Maker =
- new <xsl:value-of select="$sp_superclass"/>(
- "<xsl:value-of select='../../name'/>.<xsl:value-of select='name'/>");
- </xsl:otherwise>
+ new <xsl:value-of select="$sp_superclass"/>(
+ "<xsl:value-of select='../../name'/>.<xsl:value-of select='name'/>");
+ </xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:if>
static public Property.Maker maker(String propName) {
- return new <xsl:value-of select="$classname"/>(propName);
+ return new <xsl:value-of select="$classname"/>(propName);
}
protected <xsl:value-of select="$classname"/>(String name) {
- super(name);
+ super(name);
<xsl:if test="compound">
m_shorthandMaker= getSubpropMaker("<xsl:value-of select='compound/subproperty[@set-by-shorthand="true"]/name'/>");
</xsl:if>
Property.Maker m_shorthandMaker;
public Property checkEnumValues(String value) {
- return m_shorthandMaker.checkEnumValues(value);
+ return m_shorthandMaker.checkEnumValues(value);
}
protected boolean isCompoundMaker() {
protected Property.Maker getSubpropMaker(String subprop) {
<xsl:for-each select="compound/subproperty">
<xsl:variable name="spname">
- <xsl:call-template name="makeClassName">
+ <xsl:call-template name="makeClassName">
<xsl:with-param name="propstr" select="name"/>
</xsl:call-template>
</xsl:variable>
- if (subprop.equals("<xsl:value-of select='name'/>"))
- return s_<xsl:value-of select="$spname"/>Maker;
+ if (subprop.equals("<xsl:value-of select='name'/>"))
+ return s_<xsl:value-of select="$spname"/>Maker;
</xsl:for-each>
- return super.getSubpropMaker(subprop);
+ return super.getSubpropMaker(subprop);
}
protected Property setSubprop(Property baseProp, String subpropName,
- Property subProp) {
+ Property subProp) {
<xsl:value-of select="datatype"/> val = baseProp.get<xsl:value-of select="datatype"/>();
- // Do some type checking???
- // Check if one of our subproperties???
- val.setComponent(subpropName, subProp, false);
- return baseProp;
+ // Do some type checking???
+ // Check if one of our subproperties???
+ val.setComponent(subpropName, subProp, false);
+ return baseProp;
}
public Property getSubpropValue(Property baseProp, String subpropName) {
public Property make(PropertyList propertyList) throws FOPException {
if (m_defaultProp == null) {
m_defaultProp=makeCompound(propertyList, propertyList.getParentFObj());
- }
+ }
return m_defaultProp;
}
</xsl:otherwise>
</xsl:choose>
protected Property makeCompound(PropertyList pList, FObj fo) throws FOPException {
- <xsl:value-of select="datatype"/> p = new <xsl:value-of select="datatype"/>();
- Property subProp;
+ <xsl:value-of select="datatype"/> p = new <xsl:value-of select="datatype"/>();
+ Property subProp;
<xsl:for-each select="compound/subproperty/name">
<xsl:variable name="spname">
- <xsl:call-template name="makeClassName">
- <xsl:with-param name="propstr" select="."/>
- </xsl:call-template>
+ <xsl:call-template name="makeClassName">
+ <xsl:with-param name="propstr" select="."/>
+ </xsl:call-template>
</xsl:variable>
- // set default for subprop <xsl:value-of select="."/>
- subProp = getSubpropMaker("<xsl:value-of select='.'/>").make(pList,
- getDefaultFor<xsl:value-of select='$spname'/>(), fo);
- p.setComponent("<xsl:value-of select='.'/>", subProp, true);
+ // set default for subprop <xsl:value-of select="."/>
+ subProp = getSubpropMaker("<xsl:value-of select='.'/>").make(pList,
+ getDefaultFor<xsl:value-of select='$spname'/>(), fo);
+ p.setComponent("<xsl:value-of select='.'/>", subProp, true);
</xsl:for-each>
- return new <xsl:value-of select="$propclass"/>(p);
+ return new <xsl:value-of select="$propclass"/>(p);
}
<!-- generate a "getDefaultForXXX" for each subproperty XXX -->
<xsl:for-each select="compound/subproperty">
<xsl:variable name="spname">
- <xsl:call-template name="makeClassName">
- <xsl:with-param name="propstr" select="name"/>
- </xsl:call-template>
+ <xsl:call-template name="makeClassName">
+ <xsl:with-param name="propstr" select="name"/>
+ </xsl:call-template>
</xsl:variable>
protected String getDefaultFor<xsl:value-of select='$spname'/>() {
<xsl:choose><xsl:when test="default">
- return "<xsl:value-of select='default'/>";
+ return "<xsl:value-of select='default'/>";
</xsl:when><xsl:when test="use-generic and key('genericref', use-generic)/default">
- return "<xsl:value-of select='key('genericref', use-generic)/default'/>";
+ return "<xsl:value-of select='key('genericref', use-generic)/default'/>";
</xsl:when><xsl:otherwise>
- return "";
- </xsl:otherwise>
+ return "";
+ </xsl:otherwise>
</xsl:choose>
}
</xsl:for-each>
/** Set the appropriate components when the "base" property is set. */
public Property convertProperty(Property p, PropertyList pList,FObj fo)
- throws FOPException
+ throws FOPException
{
if (p instanceof <xsl:value-of select="$propclass"/>) return p;
- if (! (p instanceof EnumProperty)) {
- // delegate to the subprop maker to do conversions
- p = m_shorthandMaker.convertProperty(p,pList,fo);
+ if (! (p instanceof EnumProperty)) {
+ // delegate to the subprop maker to do conversions
+ p = m_shorthandMaker.convertProperty(p,pList,fo);
}
- if (p != null) {
- Property prop = makeCompound(pList, fo);
+ if (p != null) {
+ Property prop = makeCompound(pList, fo);
- <xsl:value-of select="datatype"/> pval = prop.get<xsl:value-of select="datatype"/>();
+ <xsl:value-of select="datatype"/> pval = prop.get<xsl:value-of select="datatype"/>();
<xsl:for-each select="compound/subproperty[@set-by-shorthand='true']">
- pval.setComponent("<xsl:value-of select='name'/>", p, false);
+ pval.setComponent("<xsl:value-of select='name'/>", p, false);
</xsl:for-each>
return prop;
}
- else return null;
+ else return null;
<!--
else {
- // throw some kind of exception!
- throw new FOPException("Can't convert value to <xsl:value-of select='$spdt'/> type");
+ // throw some kind of exception!
+ throw new FOPException("Can't convert value to <xsl:value-of select='$spdt'/> type");
}
-->
}
<!-- the default implementation returns false -->
<xsl:if test='inherited/@type="specified"'>
public boolean inheritsSpecified() {
- return true;
+ return true;
}
</xsl:if>
Property p=null;
<xsl:choose><xsl:when test="corresponding/propexpr">
<xsl:apply-templates select="corresponding/propval"/>
- // Make sure the property is set before calculating it!
+ // Make sure the property is set before calculating it!
if (propertyList.getExplicitOrShorthand(sbExpr.toString()) == null) return p;
sbExpr.setLength(0);
<xsl:apply-templates select="corresponding/propexpr"/>
<xsl:choose><xsl:when test="propexpr">
<xsl:apply-templates select="propexpr"/>
subprop= getSubpropMaker("<xsl:value-of select='../name'/>").
- make(propertyList, sbExpr.toString(), parentFO);
+ make(propertyList, sbExpr.toString(), parentFO);
</xsl:when><xsl:otherwise>
<xsl:apply-templates select="propval"/>
subprop= propertyList.getExplicitOrShorthand(sbExpr.toString());
Property p = null;
ListProperty listprop;
<xsl:for-each select="shorthand">
- <xsl:variable name="shprop" select="."/>
+ <xsl:variable name="shprop" select="."/>
if (p == null) {
listprop = (ListProperty)propertyList.getExplicit("<xsl:value-of select='$shprop'/>");
if (listprop != null) {
<xsl:param name="dtlist"/>
<xsl:variable name="dt"><xsl:value-of select='$dtlist[1]'/></xsl:variable>
<xsl:for-each select="$dtlist">
- <xsl:if test=". != $dt">
- <xsl:message>
- <xsl:text>Conflict between subproperty datatypes: </xsl:text>
- <xsl:value-of select='.'/> != <xsl:value-of select='$dt'/>
- </xsl:message>
- </xsl:if>
+ <xsl:if test=". != $dt">
+ <xsl:message>
+ <xsl:text>Conflict between subproperty datatypes: </xsl:text>
+ <xsl:value-of select='.'/> != <xsl:value-of select='$dt'/>
+ </xsl:message>
+ </xsl:if>
</xsl:for-each>
<xsl:value-of select='$dt'/>
</xsl:template>
<xsl:variable name="lcletters" select="'abcdefghijklmnopqrstuvwxyz'" />
<xsl:variable name="ucletters" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
<xsl:value-of select="concat(translate(substring($str, 1, 1),
- $lcletters, $ucletters), substring($str, 2))"/>
+ $lcletters, $ucletters), substring($str, 2))"/>
</xsl:template>
<xsl:template name="makeClassName">
<xsl:when test="$prop/use-generic">
<!-- If no datatype child, then the prop must use the same datatype as
its template. -->
- <xsl:call-template name="propclass">
- <xsl:with-param name="prop"
- select="key('genericref', $prop/use-generic)"/>
+ <xsl:call-template name="propclass">
+ <xsl:with-param name="prop"
+ select="key('genericref', $prop/use-generic)"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<!-- ERROR -->
<xsl:message terminate="yes">
- No datatype found for property: <xsl:value-of select="$prop/name"/>
+ No datatype found for property: <xsl:value-of select="$prop/name"/>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
<xsl:when test="$prop/use-generic">
<!-- If no datatype child, then the prop must use the same datatype as
its template. -->
- <xsl:call-template name="hasEnum">
- <xsl:with-param name="prop"
- select="key('genericref', $prop/use-generic)"/>
+ <xsl:call-template name="hasEnum">
+ <xsl:with-param name="prop"
+ select="key('genericref', $prop/use-generic)"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>false</xsl:otherwise>
<xsl:when test="$prop/use-generic">
<!-- If no datatype child, then the prop must use the same datatype as
its template. -->
- <xsl:call-template name="hasSubpropEnum">
- <xsl:with-param name="prop"
- select="key('genericref', $prop/use-generic)"/>
+ <xsl:call-template name="hasSubpropEnum">
+ <xsl:with-param name="prop"
+ select="key('genericref', $prop/use-generic)"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$prop/compound/subproperty/use-generic">
- <xsl:for-each select="$prop/compound/subproperty[use-generic]">
- <xsl:call-template name="hasEnum">
- <xsl:with-param name="prop"
- select="key('genericref', use-generic)"/>
+ <xsl:for-each select="$prop/compound/subproperty[use-generic]">
+ <xsl:call-template name="hasEnum">
+ <xsl:with-param name="prop"
+ select="key('genericref', use-generic)"/>
</xsl:call-template>
- </xsl:for-each>
+ </xsl:for-each>
</xsl:when>
<xsl:otherwise>false</xsl:otherwise>
</xsl:choose>
<xsl:template match="*//attribute">
<property>
- <name><xsl:apply-templates/></name>
+ <name><xsl:apply-templates/></name>
<use-generic ispropclass="true">SVGStringProperty</use-generic>
</property>
</xsl:template>
</xsl:when>
<xsl:when test="not(@type)">
<xsl:call-template name="genmaker">
- <xsl:with-param name="htname" select="$htname"/>
+ <xsl:with-param name="htname" select="$htname"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise/>
-<!--
+<!--
This files writes the class files for the Adobe Type 1 fonts.
It uses the information in the font description files (Courier.xml, Helvetica.xml) to this
In these font description files each character is referenced by its adobe name:
};
private final static String embedFileName = <xsl:value-of select="embedFile"/>;
private final static String embedResourceName = <xsl:value-of select="embedResource"/>;
- private static PDFT1Stream embeddedFont=null;
+ private static PDFT1Stream embeddedFont=null;
private final static int flags = <xsl:value-of select="flags"/>;
private final static int stemV = <xsl:value-of select="stemv"/>;
private final static int italicAngle = <xsl:value-of select="italicangle"/>;
public PDFStream getFontFile(int i) {
InputStream instream=null;
-
+
// Get file first
if (embedFileName!=null)
try {
} catch (Exception e) {
System.out.println("Failed to embed fontfile: "+embedFileName);
}
-
+
// Get resource
if (instream==null && embedResourceName!=null)
try {
} catch (Exception e) {
System.out.println("Failed to embed fontresource: "+embedResourceName);
}
-
+
if (instream==null)
return (PDFStream)null;
-
+
// Read fontdata
byte[] file = new byte[128000];
int fsize = 0;
try {
int l = instream.read(file, 0, 128000);
fsize += l;
-
+
if (l==128000) {
// More to read - needs to extend
byte[] tmpbuf;
-
+
while (l > 0) {
tmpbuf = new byte[file.length + 64000];
System.arraycopy(file, 0, tmpbuf, 0, file.length);
l=instream.read(tmpbuf, file.length, 64000);
fsize += l;
file = tmpbuf;
-
+
if (l < 64000) // whole file read. No need to loop again
l=0;
}
}
-
+
embeddedFont=new PDFT1Stream(i, fsize);
embeddedFont.addFilter("flate");
embeddedFont.addFilter("ascii-85");
embeddedFont.setData(file, fsize);
instream.close();
- } catch (Exception e) {}
+ } catch (Exception e) {}
return (PDFStream) embeddedFont;
}
public String encoding() {
return encoding;
}
-
+
public String fontName() {
return fontName;
}
-<!--
+<!--
This files writes the class files for the Adobe Type 1 fonts.
It uses the information in the font description files (Courier.xml, Helvetica.xml) to this
In these font description files each character is referenced by its adobe name:
private final static String embedFileName = <xsl:value-of select="embedFile"/>;
private final static String embedResourceName = <xsl:value-of select="embedResource"/>;
- private static PDFTTFStream embeddedFont=null;
+ private static PDFTTFStream embeddedFont=null;
private final static int flags = <xsl:value-of select="flags"/>;
private final static int stemV = <xsl:value-of select="stemv"/>;
private final static int italicAngle = <xsl:value-of select="italicangle"/>;
}
public PDFStream getFontFile(int i) {
InputStream instream=null;
-
+
// Get file first
if (embedFileName!=null)
try {
} catch (Exception e) {
System.out.println("Failed to embed fontfile: "+embedFileName);
}
-
+
// Get resource
if (instream==null && embedResourceName!=null)
try {
} catch (Exception e) {
System.out.println("Failed to embed fontresource: "+embedResourceName);
}
-
+
if (instream==null)
return (PDFStream)null;
-
+
// Read fontdata
byte[] file = new byte[128000];
int fsize = 0;
try {
int l = instream.read(file, 0, 128000);
fsize += l;
-
+
if (l==128000) {
// More to read - needs to extend
byte[] tmpbuf;
-
+
while (l > 0) {
tmpbuf = new byte[file.length + 64000];
System.arraycopy(file, 0, tmpbuf, 0, file.length);
l=instream.read(tmpbuf, file.length, 64000);
fsize += l;
file = tmpbuf;
-
+
if (l < 64000) // whole file read. No need to loop again
l=0;
}
}
-
+
embeddedFont=new PDFTTFStream(i, fsize);
embeddedFont.addFilter("flate");
embeddedFont.addFilter("ascii-85");
embeddedFont.setData(file, fsize);
instream.close();
- } catch (Exception e) {}
+ } catch (Exception e) {}
return (PDFStream) embeddedFont;
}
public String encoding() {
return encoding;
}
-
+
public String fontName() {
return fontName;
}
} else if(_rendererType == RENDER_RTF) {
structHandler = new org.apache.fop.rtf.renderer.RTFHandler(_stream);
} else {
- if (_renderer == null) throw new Error("_renderer not set when using standard structHandler");
+ if (_renderer == null) throw new Error("_renderer not set when using standard structHandler");
structHandler = new LayoutHandler(_stream, _renderer, true);
}
-
+
structHandler.enableLogging(getLogger());
_treeBuilder.setUserAgent(getUserAgent());
* originally contributed by
* Stanislav Gorkhover: stanislav.gorkhover@jcatalog.com
* jCatalog Software AG
- *
+ *
* Updated by Mark Lillywhite, mark-fop@inomial.com. Modified to
- * handle the print job better, added -Ddialog option, removed
+ * handle the print job better, added -Ddialog option, removed
* (apparently) redundant copies code, generally cleaned up, and
* added interfaces to the new Render API.
*/
* Rotated 90 degrees clockwise
*/
public static final int ORIENT_90 = 1;
-
+
/**
* Rotate 180 degrees
*/
public static final int ORIENT_180 = 2;
-
+
/**
* Rotated 270 degrees clockwise
*/
public static final int ORIENT_270 = 3;
// area class values
-
+
/**
* Normal class
*/
endDocExt.add(ext);
break;
}
- }
+ }
private void renderExtensions(List list) {
for (int count = 0; count < list.size(); count++) {
String fname = "page" + page.toString() + ".ser";
tempstream = new ObjectOutputStream(new BufferedOutputStream(
new FileOutputStream(fname)));
- page.savePage(tempstream);
+ page.savePage(tempstream);
tempstream.close();
pageMap.put(page, fname);
} catch (Exception e) {
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import java.util.HashMap;
+import java.util.HashMap;
import java.util.Iterator;
/**
* The start region.
*/
public static final int START = 1;
-
+
/**
* The body region.
*/
public static final int BODY = 2;
-
+
/**
* The end region.
*/
public static final int END = 3;
-
+
/**
* The after region.
*/
/**
* Make a trait value.
*
- * @param oCode
+ * @param oCode
*/
public static Object makeTraitValue(Object oCode, String sTraitValue) {
// Get the code from the name
// FOP
import org.apache.fop.apps.FOPException;
import java.util.NoSuchElementException;
-
+
public abstract class AbstractCharIterator implements CharIterator, Cloneable {
public abstract boolean hasNext();
import java.util.Iterator;
import java.util.NoSuchElementException;
-
+
public class OneCharIterator extends AbstractCharIterator {
private boolean bFirst=true;
// Common Accessibility Properties
AccessibilityProps mAccProps = propMgr.getAccessibilityProps();
-
- // Common Aural Properties
+
+ // Common Aural Properties
AuralProps mAurProps = propMgr.getAuralProps();
// Common Border, Padding, and Background Properties
BorderAndPadding bap = propMgr.getBorderAndPadding();
BackgroundProps bProps = propMgr.getBackgroundProps();
-
+
// Common Font Properties
//this.fontState = propMgr.getFontState(area.getFontInfo());
// Common Margin Properties-Inline
MarginInlineProps mProps = propMgr.getMarginInlineProps();
-
+
// Common Relative Position Properties
RelativePositionProps mRelProps = propMgr.getRelativePositionProps();
-
+
// this.properties.get("alignment-adjust");
// this.properties.get("alignment-baseline");
// this.properties.get("baseline-shift");
public void addLayoutManager(List list) {
ListBlockLayoutManager blm = new ListBlockLayoutManager(this);
list.add(blm);
- }
+ }
public void setup() throws FOPException {
// Common Accessibility Properties
AccessibilityProps mAccProps = propMgr.getAccessibilityProps();
-
+
// Common Aural Properties
AuralProps mAurProps = propMgr.getAuralProps();
} else {
// error
}
- }
+ }
public boolean generatesInlineAreas() {
return false;
// boolean setup = false;
boolean bSepBorders = true;
-
+
/**
* Set to true if all content completely laid out.
*/
this.borderHeight = (borderBefore + borderAfter) / 2;
}
}
-
+
protected boolean containsMarkers() {
return true;
}
// Common Accessibility Properties
AccessibilityProps mAccProps = propMgr.getAccessibilityProps();
-
+
// this.properties.get("block-progression-dimension");
// Common Aural Properties
// Common Relative Position Properties
RelativePositionProps mRelProps = propMgr.getRelativePositionProps();
-
+
// this.properties.get("break-before");
// this.properties.get("break-after");
setupID();
/**
* Get a page sequence master by name.
- * This is used by the page sequence to get a page master for
+ * This is used by the page sequence to get a page master for
* creating pages.
*/
public PageSequenceMaster getPageSequenceMaster(String masterName) {
/**
* Initializes class and reads stream. Init does not close stream.
- *
+ *
* @param in InputStream to read from new array with size + inc
* @throws IOException In case of an I/O problem
*/
/**
* Constructor
- *
+ *
* @param fileName filename to read
* @throws IOException In case of an I/O problem
*/
/**
* Constructor
- *
+ *
* @param in InputStream to read from
* @throws IOException In case of an I/O problem
*/
/**
* Set current file position to offset
- *
+ *
* @param offset The new offset to set
* @throws IOException In case of an I/O problem
*/
/**
* Set current file position to offset
- *
+ *
* @param add The number of bytes to advance
* @throws IOException In case of an I/O problem
*/
/**
* Skip a given number of bytes.
- *
+ *
* @param add The number of bytes to advance
* @throws IOException In case of an I/O problem
*/
/**
* Returns current file position.
- *
+ *
* @return int The current position.
*/
public int getCurrentPos() {
/**
* Returns the size of the file.
- *
+ *
* @return int The filesize
*/
public int getFileSize() {
/**
* Read 1 byte.
- *
+ *
* @return One byte
* @throws IOException If EOF is reached
*/
/**
* Read 1 signed byte.
- *
+ *
* @return One byte
* @throws IOException If EOF is reached
*/
/**
* Read 1 unsigned byte.
- *
+ *
* @return One unsigned byte
* @throws IOException If EOF is reached
*/
/**
* Read 2 bytes signed.
- *
+ *
* @return One signed short
* @throws IOException If EOF is reached
*/
/**
* Read 2 bytes unsigned.
- *
+ *
* @return One unsigned short
* @throws IOException If EOF is reached
*/
/**
* Write a USHort at a given position.
- *
+ *
* @param pos The absolute position to write to
* @param val The value to write
* @throws IOException If EOF is reached
/**
* Read 2 bytes signed at position pos without changing current position.
- *
+ *
* @param pos The absolute position to read from
* @return One signed short
* @throws IOException If EOF is reached
/**
* Read 2 bytes unsigned at position pos without changing current position.
- *
+ *
* @param pos The absolute position to read from
* @return One unsigned short
* @throws IOException If EOF is reached
/**
* Read 4 bytes.
- *
+ *
* @return One signed integer
* @throws IOException If EOF is reached
*/
/**
* Read 4 bytes.
- *
+ *
* @return One unsigned integer
* @throws IOException If EOF is reached
*/
/**
* Read a NUL terminated ISO-8859-1 string.
- *
+ *
* @return A String
* @throws IOException If EOF is reached
*/
/**
* Read an ISO-8859-1 string of len bytes.
- *
+ *
* @param len The length of the string to read
* @return A String
* @throws IOException If EOF is reached
/**
* Return a copy of the internal array
- *
+ *
* @param offset The absolute offset to start reading from
* @param length The number of bytes to read
* @return An array of bytes
'\u2014', // emdash
'~', '\u2022', // bullet
'\u0161', '\u203a', '\u0153', '\u2022', '\u017e', '\u0178', // 0xA0
- ' ', '\u00a1', '\u00a2', '\u00a3', '\u00a4', '\u00a5',
- '\u00a6', '\u00a7', '\u00a8', '\u00a9', '\u00aa', '\u00ab',
+ ' ', '\u00a1', '\u00a2', '\u00a3', '\u00a4', '\u00a5',
+ '\u00a6', '\u00a7', '\u00a8', '\u00a9', '\u00aa', '\u00ab',
'\u00ac', '\u00ad', '\u00ae', '\u00af', // 0xb0
'\u00b0', '\u00b1', '\u00b2', '\u00b3', '\u00b4',
'\u00b5', // This is hand-coded, the rest is assumption
'\u00b6', // and *might* not be correct...
- '\u00b7', '\u00b8', '\u00b9', '\u00ba', '\u00bb', '\u00bc', '\u00bd',
+ '\u00b7', '\u00b8', '\u00b9', '\u00ba', '\u00bb', '\u00bc', '\u00bd',
'\u00be', '\u00bf', // 0xc0
'\u00c0', '\u00c1', '\u00c2', '\u00c3', '\u00c4', '\u00c5', // Aring
'\u00c6', // AE
- '\u00c7', '\u00c8', '\u00c9', '\u00ca', '\u00cb', '\u00cc',
+ '\u00c7', '\u00c8', '\u00c9', '\u00ca', '\u00cb', '\u00cc',
'\u00cd', '\u00ce', '\u00cf', // 0xd0
- '\u00d0', '\u00d1', '\u00d2', '\u00d3', '\u00d4', '\u00d5',
+ '\u00d0', '\u00d1', '\u00d2', '\u00d3', '\u00d4', '\u00d5',
'\u00d6', '\u00d7', '\u00d8', // Oslash
- '\u00d9', '\u00da', '\u00db', '\u00dc', '\u00dd', '\u00de',
+ '\u00d9', '\u00da', '\u00db', '\u00dc', '\u00dd', '\u00de',
'\u00df', // 0xe0
'\u00e0', '\u00e1', '\u00e2', '\u00e3', '\u00e4', '\u00e5', // aring
'\u00e6', // ae
- '\u00e7', '\u00e8', '\u00e9', '\u00ea', '\u00eb', '\u00ec',
+ '\u00e7', '\u00e8', '\u00e9', '\u00ea', '\u00eb', '\u00ec',
'\u00ed', '\u00ee', '\u00ef', // 0xf0
- '\u00f0', '\u00f1', '\u00f2', '\u00f3', '\u00f4', '\u00f5',
- '\u00f6', '\u00f7', '\u00f8', '\u00f9', '\u00fa', '\u00fb',
+ '\u00f0', '\u00f1', '\u00f2', '\u00f3', '\u00f4', '\u00f5',
+ '\u00f6', '\u00f7', '\u00f8', '\u00f9', '\u00fa', '\u00fb',
'\u00fc', '\u00fd', '\u00fe', '\u00ff'
};
"\uF730", "zerooldstyle",
"\u2070", "zerosuperior",
"\u03B6", "zeta"
-
+
};
/**
* the glyph indexes related to the range
*/
public class TTFCmapEntry {
-
+
private int unicodeStart;
private int unicodeEnd;
private int glyphStartIndex;
import java.io.IOException;
class TTFDirTabEntry {
-
+
private byte[] tag = new byte[4];
private int checksum;
private long offset;
//System.out.println(this.toString());
return new String(tag, "ISO-8859-1");
}
-
-
+
+
public String toString() {
- return "Read dir tab ["
+ return "Read dir tab ["
+ tag[0] + " " + tag[1] + " " + tag[2] + " " + tag[3] + "]"
+ " offset: " + offset
- + " length: " + length
+ + " length: " + length
+ " name: " + tag;
}
* Typography site: http://www.microsoft.com/truetype/
*/
public class TTFFile extends AbstractLogEnabled {
-
+
static final byte NTABS = 24;
static final int NMACGLYPHS = 258;
static final int MAX_CHAR_CODE = 255;
static final int ENC_BUF_SIZE = 1024;
private String encoding = "WinAnsiEncoding"; // Default encoding
-
+
private short firstChar = 0;
private boolean isEmbeddable = true;
private boolean hasSerifs = true;
/**
* Table directory
*/
- protected Map dirTabs;
+ protected Map dirTabs;
private Map kerningTab; // for CIDs
private Map ansiKerningTab; // For winAnsiEncoding
private List cmaps;
- private List unicodeMapping;
+ private List unicodeMapping;
private int upem; // unitsPerEm from "head" table
private int nhmtx; // Number of horizontal metrics
/**
* Contains glyph data
- */
+ */
protected TTFMtxEntry mtxTab[]; // Contains glyph data
private int[] mtxEncoded = null;
int cmapEID = in.readTTFUShort();
long cmapOffset = in.readTTFULong();
- getLogger().debug("Platform ID: " + cmapPID
+ getLogger().debug("Platform ID: " + cmapPID
+ " Encoding: " + cmapEID);
if (cmapPID == 3 && cmapEID == 1) {
getLogger().debug("searchRange : " + cmapSearchRange);
getLogger().debug("entrySelector: " + cmapEntrySelector);
getLogger().debug("rangeShift : " + cmapRangeShift);
-
+
int cmapEndCounts[] = new int[cmapSegCountX2 / 2];
int cmapStartCounts[] = new int[cmapSegCountX2 / 2];
// and fill in the cmaps ArrayList
for (int i = 0; i < cmapStartCounts.length; i++) {
-
- getLogger().debug(i + ": " + cmapStartCounts[i]
+
+ getLogger().debug(i + ": " + cmapStartCounts[i]
+ " - " + cmapEndCounts[i]);
-
+
for (int j = cmapStartCounts[i]; j <= cmapEndCounts[i]; j++) {
// Update lastChar
// the last character 65535 = .notdef
// may have a range offset
if (cmapRangeOffsets[i] != 0 && j != 65535) {
- int glyphOffset = glyphIdArrayOffset
- + ((cmapRangeOffsets[i] / 2)
- + (j - cmapStartCounts[i])
+ int glyphOffset = glyphIdArrayOffset
+ + ((cmapRangeOffsets[i] / 2)
+ + (j - cmapStartCounts[i])
+ (i)
- cmapSegCountX2 / 2) * 2;
in.seekSet(glyphOffset);
Integer aIdx = (Integer)e.next();
ansiWidth[aIdx.intValue()] =
mtxTab[glyphIdx].getWx();
-
+
getLogger().debug("Added width "
- + mtxTab[glyphIdx].getWx()
- + " uni: " + j
+ + mtxTab[glyphIdx].getWx()
+ + " uni: " + j
+ " ansi: " + aIdx.intValue());
}
}
-
- getLogger().debug("Idx: "
- + glyphIdx
- + " Delta: " + cmapDeltas[i]
- + " Unicode: " + j
+
+ getLogger().debug("Idx: "
+ + glyphIdx
+ + " Delta: " + cmapDeltas[i]
+ + " Unicode: " + j
+ " name: " + mtxTab[glyphIdx].getName());
} else {
glyphIdx = (j + cmapDeltas[i]) & 0xffff;
ansiWidth[aIdx.intValue()] = mtxTab[glyphIdx].getWx();
}
}
-
+
//getLogger().debug("IIdx: " +
// mtxPtr +
// " Delta: " + cmap_deltas[i] +
// " Unicode: " + j +
// " name: " +
// mtxTab[(j+cmap_deltas[i]) & 0xffff].name);
-
+
}
if (glyphIdx < mtxTab.length) {
if (mtxTab[glyphIdx].getUnicodeIndex().size() < 2) {
getLogger().info("Max: " + max);
}
-
+
/**
* Reads the font using a FontFileReader.
- *
+ *
* @param in The FontFileReader to use
* @throws IOException In case of an I/O problem
*/
}
/**
- * Returns the index of the last character, but this is for WinAnsiEncoding
+ * Returns the index of the last character, but this is for WinAnsiEncoding
* only, so the last char is < 256.
* @return short Index of the last character (<256)
*/
for (int i = 0; i < nhmtx; i++) {
mtxTab[i].setWx(in.readTTFUShort());
mtxTab[i].setLsb(in.readTTFUShort());
-
- getLogger().debug(" width[" + i + "] = "
+
+ getLogger().debug(" width[" + i + "] = "
+ convertTTFUnit2PDFUnit(mtxTab[i].getWx()) + ";");
}
}
// firstChar=minIndex;
psGlyphsBuffer = new String[numGlyphStrings];
- getLogger().debug("Reading " + numGlyphStrings
+ getLogger().debug("Reading " + numGlyphStrings
+ " glyphnames" + ", was n num glyphs=" + l);
for (i = 0; i < psGlyphsBuffer.length; i++) {
psGlyphsBuffer[i] = in.readTTFString(in.readTTFUByte());
} else {
k = mtxTab[i].getIndex() - NMACGLYPHS;
- getLogger().debug(k + " i=" + i + " mtx=" + mtxTab.length
+ getLogger().debug(k + " i=" + i + " mtx=" + mtxTab.length
+ " ps=" + psGlyphsBuffer.length);
mtxTab[i].setName(psGlyphsBuffer[k]);
in.seekSet(n + mtxTab[i].getOffset());
in.skip(2);
final int[] bbox = {
- in.readTTFShort(),
- in.readTTFShort(),
- in.readTTFShort(),
+ in.readTTFShort(),
+ in.readTTFShort(),
+ in.readTTFShort(),
in.readTTFShort()};
mtxTab[i].setBoundingBox(bbox);
} else {
// if (k==1 || k==2 || k==0 || k==4 || k==6) {
in.seekSet(j + in.readTTFUShort());
String txt = in.readTTFString(l);
- // getLogger().debug(platform_id + " " + encoding_id
+ // getLogger().debug(platform_id + " " + encoding_id
// + " " + k + " " + txt);
switch (k) {
case 0:
fontName = txt;
break;
}
- if (!notice.equals("")
+ if (!notice.equals("")
&& !fullName.equals("")
- && !fontName.equals("")
+ && !fontName.equals("")
&& !familyName.equals("")
&& !subFamilyName.equals("")) {
break;
* Key-value helper class
*/
class UnicodeMapping {
-
+
private int uIdx;
private int gIdx;
-
+
UnicodeMapping(int gIdx, int uIdx) {
this.uIdx = uIdx;
this.gIdx = gIdx;
import java.util.List;
class TTFMtxEntry {
-
+
private int wx;
private int lsb;
private String name = "";
public String toString(TTFFile t) {
return "Glyph " + name + " index: " + index + " bbox [ "
- + t.convertTTFUnit2PDFUnit(boundingBox[0]) + " "
- + t.convertTTFUnit2PDFUnit(boundingBox[1]) + " "
- + t.convertTTFUnit2PDFUnit(boundingBox[2]) + " "
- + t.convertTTFUnit2PDFUnit(boundingBox[3]) + "] wx: "
+ + t.convertTTFUnit2PDFUnit(boundingBox[0]) + " "
+ + t.convertTTFUnit2PDFUnit(boundingBox[1]) + " "
+ + t.convertTTFUnit2PDFUnit(boundingBox[2]) + " "
+ + t.convertTTFUnit2PDFUnit(boundingBox[3]) + "] wx: "
+ t.convertTTFUnit2PDFUnit(wx);
}
* Typography site: http://www.microsoft.com/truetype/
*/
public class TTFSubSetFile extends TTFFile {
-
+
private byte[] output = null;
private int realSize = 0;
private int currentPos = 0;
if (entry != null) {
pad4();
//int offset = (int)entry.offset;
- Iterator e = glyphs.keySet().iterator();
+ Iterator e = glyphs.keySet().iterator();
while (e.hasNext()) {
Integer origIndex = (Integer)e.next();
Integer subsetIndex = (Integer)glyphs.get(origIndex);
// Inefficient to iterate through all glyphs
newComposites = new java.util.HashMap();
- Iterator e = glyphs.keySet().iterator();
+ Iterator e = glyphs.keySet().iterator();
while (e.hasNext()) {
Integer origIndex = (Integer)e.next();
/**
* Returns a subset of the original font.
- *
+ *
* @param in FontFileReader to read from
* @param name Name to be checked for in the font file
- * @param glyphs Map of glyphs (glyphs has old index as (Integer) key and
+ * @param glyphs Map of glyphs (glyphs has old index as (Integer) key and
* new index as (Integer) value)
* @return A subset of the original font
* @throws IOException in case of an I/O problem
<xsl:output method="xml"/>
<xsl:template match="@*|node()">
- <xsl:copy>
- <xsl:apply-templates select="@*|node()"/>
- </xsl:copy>
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
</xsl:template>
<xsl:template match="widths">
- <xsl:element name="widths">
- <xsl:for-each select="char">
- <xsl:variable name="char-num" select="@ansichar"/>
- <xsl:variable name="char-name" select="document('file:charlist.xml')/font-mappings/map[@win-ansi=$char-num]/@adobe-name"/>
- <xsl:if test="$char-name!=''">
- <xsl:element name="char">
- <xsl:attribute name="name"><xsl:value-of select="$char-name"/></xsl:attribute>
- <xsl:attribute name="width"><xsl:value-of select="@width"/></xsl:attribute>
- </xsl:element>
- </xsl:if>
- </xsl:for-each>
- </xsl:element>
+ <xsl:element name="widths">
+ <xsl:for-each select="char">
+ <xsl:variable name="char-num" select="@ansichar"/>
+ <xsl:variable name="char-name" select="document('file:charlist.xml')/font-mappings/map[@win-ansi=$char-num]/@adobe-name"/>
+ <xsl:if test="$char-name!=''">
+ <xsl:element name="char">
+ <xsl:attribute name="name"><xsl:value-of select="$char-name"/></xsl:attribute>
+ <xsl:attribute name="width"><xsl:value-of select="@width"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
</xsl:template>
</xsl:stylesheet>
<xsl:output method="xml"/>
<xsl:template match="@*|node()">
- <xsl:copy>
- <xsl:apply-templates select="@*|node()"/>
- </xsl:copy>
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
</xsl:template>
<xsl:template match="widths">
- <xsl:copy>
- <xsl:apply-templates select="char">
- <xsl:sort select="@name" case-order="upper-first"/>
- </xsl:apply-templates>
- </xsl:copy>
+ <xsl:copy>
+ <xsl:apply-templates select="char">
+ <xsl:sort select="@name" case-order="upper-first"/>
+ </xsl:apply-templates>
+ </xsl:copy>
</xsl:template>
* Load a bitmap array of the image.
* If the renderer requires a bitmap image then the
* implementations should override this to load the bitmap.
- *
+ *
* @param ua the user agent
* @return true if the loading was successful
*/
/**
* Load the original image data.
* In some cases the original data can be used by the renderer.
- * This should load the data and any other associated information.
+ * This should load the data and any other associated information.
*
* @param ua the user agent
* @return true if the loading was successful
* the image.
* The image should then be put into the weak cache.
*
- * @param url the url for the image
+ * @param url the url for the image
* @param context the user agent context
*/
public void releaseImage(String url, FOUserAgent context) {
* @param href image URL as a String
* @return a new FopImage object
*
- * @param href the url for the image
+ * @param href the url for the image
* @param baseURL the base url
* @param ua the user agent context
* @return the fop image instance
protected boolean hasMoreLM(LayoutManager prevLM) {
// prevLM should = curChildLM
if (prevLM != curChildLM) {
- //log.debug("AbstractLayoutManager.peekNextLM: " +
+ //log.debug("AbstractLayoutManager.peekNextLM: " +
// "passed LM is not current child LM!");
return false;
}
* If pos is null, then back up to the first child LM.
*/
protected void reset(Position pos) {
- //if (lm == null) return;
+ //if (lm == null) return;
LayoutManager lm = (pos != null) ? pos.getLM() : null;
if (curChildLM != lm) {
// ASSERT curChildLM == (LayoutManager)childLMiter.previous()
* This method provides a hook for a LayoutManager to intialize traits
* for the areas it will create, based on Properties set on its FO.
*/
- public void init() {
+ public void init() {
if (fobj != null && bInited == false) {
initProperties(fobj.getPropertyManager());
bInited = true;
protected void initProperties(PropertyManager pm) {
//log.debug("AbstractLayoutManager.initProperties");
}
-
+
/**
* Tell whether this LayoutManager has handled all of its content.
/**
* Add background to an area.
- * Layout managers that create areas with a background can use this to
+ * Layout managers that create areas with a background can use this to
* add the background to the area.
*/
public static void addBackground(Area curBlock, BackgroundProps backProps) {
back.vertical = backProps.backPosVertical.mvalue();
}
}
-
+
if(back.color != null || back.url != null) {
curBlock.addTrait(Trait.BACKGROUND, back);
}
while ((curLM = getChildLM()) != null) {
// Make break positions and return blocks!
- // Set up a LayoutContext
+ // Set up a LayoutContext
BreakPoss bp;
LayoutContext childLC = new LayoutContext(0);
borderProps = pm.getBorderAndPadding();
backgroundProps = pm.getBackgroundProps();
}
-
+
public BreakPoss getNextBreakPoss(LayoutContext context) {
LayoutManager curLM; // currently active LM
*/
public class FlowLayoutManager extends BlockStackingLayoutManager {
- protected List blockBreaks = new ArrayList();
+ protected List blockBreaks = new ArrayList();
/** Array of areas currently being filled stored by area class */
private BlockParent[] currentAreas = new BlockParent[Area.CLASS_MAX];
PositionIterator breakPosIter =
new BreakPossPosIter(blockBreaks, iStartPos,
lfp.getLeafPos() + 1);
- iStartPos = lfp.getLeafPos() + 1;
+ iStartPos = lfp.getLeafPos() + 1;
while ((childLM = breakPosIter.getNextChildLM()) != null) {
childLM.addAreas(breakPosIter, lc);
}
private int follow;
// inline start pos when adding areas
- int iStartPos = 0;
+ int iStartPos = 0;
/**
* Create a new Line Layout Manager.
BreakPoss bp = (BreakPoss)iter.next();
if (bp.getLead() > lineLead) {
lineLead = bp.getLead();
- }
+ }
if (bp.getTotal() > maxtb) {
maxtb = bp.getTotal();
}
private Flow curFlow;
private int flowBPD = 0;
- private int flowIPD = 0;
+ private int flowIPD = 0;
/** Manager which handles a queue of all pages which are completely
* laid out and ready for rendering, except for resolution of ID
}
}
}
-
+
private void finishPage() {
if (curPage != null) {
// Layout static content into the regions
public class StaticContentLayoutManager extends BlockStackingLayoutManager {
private RegionReference region;
- private List blockBreaks = new ArrayList();
-
+ private List blockBreaks = new ArrayList();
+
public StaticContentLayoutManager(FObj fobj) {
super(fobj);
}
public void setRegionReference(RegionReference region) {
this.region = region;
}
-
+
public BreakPoss getNextBreakPoss(LayoutContext context) {
// currently active LM
PositionIterator breakPosIter =
new BreakPossPosIter(blockBreaks, iStartPos,
lfp.getLeafPos() + 1);
- iStartPos = lfp.getLeafPos() + 1;
+ iStartPos = lfp.getLeafPos() + 1;
while ((childLM = breakPosIter.getNextChildLM()) != null) {
childLM.addAreas(breakPosIter, lc);
}
}
BreakPoss breakPoss = new BreakPoss(
new LeafPosition(this, childBreaks.size() - 1));
- if (over) {
+ if (over) {
breakPoss.setFlag(BreakPoss.NEXT_OVERFLOWS, true);
}
breakPoss.setStackingSize(stackSize);
}
BreakPoss breakPoss = new BreakPoss(
new LeafPosition(this, bodyBreaks.size() - 1));
- if (over) {
+ if (over) {
breakPoss.setFlag(BreakPoss.NEXT_OVERFLOWS, true);
}
breakPoss.setStackingSize(stackSize);
}
}
- if(borderProps != null) {
+ if(borderProps != null) {
addBorders(curBlockArea, borderProps);
}
if(backgroundProps != null) {
bodyBreaks.clear();
reset(null);
} else {
-
+
}
}
}
ItemPosition rp = new ItemPosition(this, breakList.size() - 1, breakList);
BreakPoss breakPoss = new BreakPoss(rp);
- if (over) {
+ if (over) {
breakPoss.setFlag(BreakPoss.NEXT_OVERFLOWS, true);
}
breakPoss.setStackingSize(itemSize);
// the optimum is the maximum of all optimums
if (stackSize.opt > opt) {
opt = stackSize.opt;
- }
+ }
// the maximum is the largest maximum
if (stackSize.max > max) {
max = stackSize.max;
setFinished(true);
RowPosition rp = new RowPosition(this, breakList.size() - 1, breakList);
BreakPoss breakPoss = new BreakPoss(rp);
- if (over) {
+ if (over) {
breakPoss.setFlag(BreakPoss.NEXT_OVERFLOWS, true);
}
breakPoss.setStackingSize(rowSize);
* @param pos a Position returned by a child layout manager
* representing a potential break decision.
* If pos is null, then back up to the first child LM.
- */
+ */
protected void reset(Position pos) {
LayoutManager curLM; // currently active LM
int cellcount = 0;
*/
public void setYOffset(int off) {
yoffset = off;
- }
+ }
/**
* Add the areas for the break points.
curBlockArea.setHeight(tableHeight);
- if(borderProps != null) {
+ if(borderProps != null) {
addBorders(curBlockArea, borderProps);
}
if(backgroundProps != null) {
}
public void endPageSequence(PageSequence pageSeq) throws FOPException {
-
+
}
public void startFlow(Flow fl) {
StreamUtilities.streamCopy(in, out, length);
out.close();
}
-
+
}
private boolean hasICCProfile;
private byte[] iccProfile;
private int numComponents;
-
+
// Ok... so I had some grand purpose for this, but I can't recall.
// I'm just writing it
-
+
public static int DEVICE_UNKNOWN = -1;
public static int DEVICE_GRAY = 1;
// what's the *official* spelling?
/**
* List of Links.
- */
+ */
protected List links = new ArrayList();
/**
* List of FileSpecs.
- */
+ */
protected List filespecs = new ArrayList();
/**
* List of GoToRemotes.
- */
+ */
protected List gotoremotes = new ArrayList();
/**
* List of GoTos.
- */
+ */
protected List gotos = new ArrayList();
/**
* creates an empty PDF document <p>
- *
+ *
* The constructor creates a /Root and /Pages object to
* track the document but does not write these objects until
* the trailer is written. Note that the object ID of the
/**
* Add an annotation list object to the pdf document
*
- * @param obj the annotation list to add
- */
+ * @param obj the annotation list to add
+ */
public void addAnnotList(PDFAnnotList obj) {
this.objects.add(obj);
}
* add the position of this object to the list of object
* locations
*/
- location.set(object.getNumber() - 1,
+ location.set(object.getNumber() - 1,
new Integer(this.position));
/*
output(stream);
for (int count = 0; count < trailerObjects.size(); count++) {
PDFObject o = (PDFObject) trailerObjects.get(count);
- this.location.set(o.getNumber() - 1,
+ this.location.set(o.getNumber() - 1,
new Integer(this.position));
this.position += o.output(stream);
}
}
if (range != null) {
if (!range.equals(func.range)) {
- return false;
+ return false;
}
} else if (func.range != null) {
return false;
}
if (size != null) {
if (!size.equals(func.size)) {
- return false;
+ return false;
}
} else if (func.size != null) {
return false;
}
if (encode != null) {
if (!encode.equals(func.encode)) {
- return false;
+ return false;
}
} else if (func.encode != null) {
return false;
}
if (decode != null) {
if (!decode.equals(func.decode)) {
- return false;
+ return false;
}
} else if (func.decode != null) {
return false;
}
if (functionDataStream != null) {
if (!functionDataStream.equals(func.functionDataStream)) {
- return false;
+ return false;
}
} else if (func.functionDataStream != null) {
return false;
public class PDFICCStream extends PDFStream {
private int origLength;
private int len1, len3;
-
+
private ICC_Profile cp;
private PDFColorSpace pdfColorSpace;
this.cp = cp;
pdfColorSpace = alt;
}
-
+
public PDFICCStream(int num) {
super(num);
cp = null;
}
-
+
// overload the base object method so we don't have to copy
// byte arrays around so much
protected int output(java.io.OutputStream stream)
StringBuffer pb = new StringBuffer();
pb.append(this.number).append(" ").append(this.generation).append(" obj\n<< ");
pb.append("/N ").append(cp.getNumComponents()).append(" ");
-
+
if (pdfColorSpace != null) {
pb.append("/Alternate /").append(pdfColorSpace.getColorSpacePDFString()).append(" ");
}
-
+
pb.append("/Length ").append((_data.getSize() + 1)).append(" ").append(filterEntry);
pb.append(" >>\n");
byte[] p = pb.toString().getBytes();
// byte order marker (0xfeff)
result.append("\\376\\377");
-
+
for (int i = 0; i < l; i++) {
char ch = s.charAt(i);
int high = (ch & 0xff00) >>> 8;
* specifies the dimensions of the page and references a /Resources
* object, a contents stream and the page's parent in the page
* hierarchy.
- *
+ *
* Modified by Mark Lillywhite, mark-fop@inomial.com. The Parent
* object was being referred to by reference, but all that we
* ever used from the Parent was it's PDF object ID, and according
/**
* set this page contents
- *
+ *
* @param contents the contents of the page
*/
public void setContents(PDFStream contents) {
* specifies the dimensions of the page and references a /Resources
* object, a contents stream and the page's parent in the page
* hierarchy.
- *
+ *
* Modified by Mark Lillywhite, mark-fop@inomial.com. The Parent
* object was being referred to by reference, but all that we
* ever used from the Parent was it's PDF object ID, and according
metricsFile,
configFontInfo.getKerning());
fontInfo.addMetrics(internalName, font);
-
+
ArrayList triplets = configFontInfo.getFontTriplets();
for (int c = 0; c < triplets.size(); c++) {
FontTriplet triplet = (FontTriplet)triplets.get(c);
protected PDFStream getPSDataStream() throws IOException {
int length = 0;
- int i = 0;
+ int i = 0;
EPSImage epsImage = (EPSImage) fopImage;
- int[] bbox = epsImage.getBBox();
+ int[] bbox = epsImage.getBBox();
int bboxw = bbox[2] - bbox[0];
int bboxh = bbox[3] - bbox[1];
import org.apache.fop.fo.properties.RuleStyle;
import org.apache.fop.fo.properties.BackgroundRepeat;
import org.apache.fop.pdf.PDFStream;
-import org.apache.fop.pdf.PDFDocument;
+import org.apache.fop.pdf.PDFDocument;
import org.apache.fop.pdf.PDFInfo;
import org.apache.fop.pdf.PDFResources;
import org.apache.fop.pdf.PDFResourceContext;
import org.apache.fop.pdf.PDFXObject;
-import org.apache.fop.pdf.PDFPage;
+import org.apache.fop.pdf.PDFPage;
import org.apache.fop.pdf.PDFState;
import org.apache.fop.pdf.PDFLink;
import org.apache.fop.pdf.PDFOutline;
import org.apache.fop.area.Trait;
import org.apache.fop.area.TreeExt;
-import org.apache.fop.area.CTM;
+import org.apache.fop.area.CTM;
import org.apache.fop.area.Title;
import org.apache.fop.area.PageViewport;
import org.apache.fop.area.Page;
closeText();
currentStream.add("ET\n");
}
- currentStream.add("q\n");
+ currentStream.add("q\n");
float x = (float)bv.getXOffset() / 1000f;
float y = (float)bv.getYOffset() / 1000f;
float width = (float)bv.getWidth() / 1000f;
if (ctm != null) {
endVParea();
}
-
+
if (bv.getClip()) {
currentStream.add("Q\n");
if (ctm == null) {
import org.apache.fop.render.pdf.FontReader;
public class LazyFont extends Font implements FontDescriptor {
-
+
private String metricsFileName = null;
private String fontEmbedPath = null;
private boolean useKerning = false;
-
+
private boolean isMetricsLoaded = false;
private Font realFont = null;
private FontDescriptor realFontDescriptor = null;
-
+
public LazyFont(String fontEmbedPath, String metricsFileName, boolean useKerning){
this.metricsFileName = metricsFileName;
this.fontEmbedPath = fontEmbedPath;
this.useKerning = useKerning;
}
-
+
private void load(){
if(! isMetricsLoaded){
isMetricsLoaded = true;
}
}
}
-
+
public Font getRealFont(){
return realFont;
}
-
+
public boolean isMultiByte() {
return realFont.isMultiByte();
}
load();
return realFont.encoding();
}
-
+
public String fontName(){
load();
return realFont.fontName();
}
-
+
public byte getSubType(){
load();
return realFont.getSubType();
}
-
+
public char mapChar(char c){
load();
return realFont.mapChar(c);
}
-
+
// FontMetrics
public int getAscender(int size){
load();
return realFont.getAscender(size);
}
-
+
public int getCapHeight(int size){
load();
return realFont.getCapHeight(size);
}
-
+
public int getDescender(int size){
load();
return realFont.getDescender(size);
}
-
+
public int getXHeight(int size){
load();
return realFont.getXHeight(size);
}
-
+
public int getFirstChar(){
load();
return realFont.getFirstChar();
}
-
+
public int getLastChar(){
load();
return realFont.getLastChar();
}
-
+
public int width(int i, int size){
load();
return realFont.width(i, size);
}
-
+
public int[] getWidths(int size){
load();
return realFont.getWidths(size);
}
-
+
// FontDescriptor
public int getCapHeight(){
load();
return realFontDescriptor.getCapHeight();
}
-
+
public int getDescender(){
load();
return realFontDescriptor.getDescender();
}
-
+
public int getAscender(){
load();
return realFontDescriptor.getAscender();
}
-
+
public int getFlags(){
load();
return realFontDescriptor.getFlags();
}
-
+
public int[] getFontBBox(){
load();
return realFontDescriptor.getFontBBox();
}
-
+
public int getItalicAngle(){
load();
return realFontDescriptor.getItalicAngle();
}
-
+
public int getStemV(){
load();
return realFontDescriptor.getStemV();
}
-
+
public boolean hasKerningInfo(){
load();
return realFontDescriptor.hasKerningInfo();
}
-
+
public HashMap getKerningInfo(){
load();
return realFontDescriptor.getKerningInfo();
}
-
+
public boolean isEmbeddable(){
load();
return realFontDescriptor.isEmbeddable();
}
-
+
public PDFStream getFontFile(int objNum){
load();
return realFontDescriptor.getFontFile(objNum);
private RtfDocumentArea _docArea;
private RtfParagraph _para;
private boolean _warned = false;
-
+
private static final String ALPHA_WARNING = "WARNING: RTF renderer is veryveryalpha at this time, see class org.apache.fop.rtf.renderer.RTFHandler";
public RTFHandler(OutputStream os) {
}
public void startDocument() throws SAXException {
- // FIXME sections should be created
+ // FIXME sections should be created
try {
_rtfFile = new RtfFile(new OutputStreamWriter(_os));
_docArea = _rtfFile.startDocumentArea();
destination = "" + x + " " + y + " "
+ (x + width) + " " + (y + height);
}
- pdfg.addLink(getBounds(), transform, destination, type);
+ pdfg.addLink(getBounds(), transform, destination, type);
}
}
}
*/
PDFDocumentGraphics2D(boolean textAsShapes) {
super(textAsShapes);
-
+
if (!textAsShapes) {
fontInfo = new FontInfo();
FontSetup.setup(fontInfo, null);
* @param stream the stream that the final document should be written to.
* @param width the width of the document
* @param height the height of the document
- * @throws IOException an io exception if there is a problem
+ * @throws IOException an io exception if there is a problem
* writing to the output stream
*/
public PDFDocumentGraphics2D(boolean textAsShapes, OutputStream stream,
return false;
}
- // first we look to see if we've already added this image to
+ // first we look to see if we've already added this image to
// the pdf document. If so, we just reuse the reference;
// otherwise we have to build a FopImage and add it to the pdf
// document
boolean newTransform = graphicsState.checkTransform(trans)
&& !trans.isIdentity();
- if (newClip || newTransform) {
+ if (newClip || newTransform) {
currentStream.write("q\n");
graphicsState.push();
if (newClip) {
if (outputStream != null) {
try {
- this.pdfDoc.output(outputStream);
+ this.pdfDoc.output(outputStream);
} catch (IOException ioe) {
// ignore exception, will be thrown again later
}
float size;
name = fontState.getFontName();
size = (float)fontState.getFontSize() / 1000f;
-
+
if ((!name.equals(this.currentFontName))
|| (size != this.currentFontSize)) {
- this.currentFontName = name;
+ this.currentFontName = name;
this.currentFontSize = size;
currentStream.write("/" + name + " " + size + " Tf\n");
HashMap vals = new HashMap();
vals.put(PDFGState.ca, new Float(salpha / 255f));
PDFGState gstate = pdfDoc.makeGState(vals, graphicsState.getGState());
- resourceContext.addGState(gstate);
+ resourceContext.addGState(gstate);
currentStream.write("/" + gstate.getName() + " gs\n");
}
public class GoToPageDialog extends JDialog {
private JTextField pgNbField;
private int pageNumber = -1;
-
+
/**
* Creates modal dialog with a given title, attached to a given frame.
*/
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
-
+
package org.apache.fop.viewer;
-
+
//Java
import java.awt.*;
import javax.swing.*;
String msg = translator.getString("Exception.Occured");
setStatus(msg);
JOptionPane.showMessageDialog(
- getContentPane(),
+ getContentPane(),
"<html><b>" + msg + ":</b><br>"
- + e.getClass().getName() + "<br>" + e.getMessage() + "</html>", translator.getString("Exception.Error"),
+ + e.getClass().getName() + "<br>" + e.getMessage() + "</html>", translator.getString("Exception.Error"),
JOptionPane.ERROR_MESSAGE
- );
+ );
}
}
* LICENSE file included with these sources.
*/
-package org.apache.fop.viewer;
+package org.apache.fop.viewer;
//Java
-import java.util.ResourceBundle;
+import java.util.ResourceBundle;
import java.util.Locale;
import java.util.MissingResourceException;
-/**
+/**
* AWT Viewer's localization class, backed up by <code>java.util.ResourceBundle</code>.
* Originally contributed by:
* Stanislav.Gorkhover@jCatalog.com
* Default constructor, default <code>Locale</code> is used.
*/
public Translator() {
- this(Locale.getDefault());
+ this(Locale.getDefault());
}
-
- /**
+
+ /**
* Constructor for a given <code>Locale</code>.
*/
public Translator(Locale locale) {