Character Rules

Character rules are applied to the document after Word Rules. They are applied to groups of characters (i.e. numbers and symbols like $ % & # @ .....). Individual letters cannot be highlighted using character rules.

All characterrules must sit with the <characterRules></characterRules> tags within the XML file.

The following is an example of a character rule definition:

    <rule active="true" bold="false" underline="false" italic="false" color="red">
      <characters>
        <!--space seperated list of chars-->
        <![CDATA[+ - / * =]]>
      </characters>
    </rule>

Rule Attributes

The attributes for the rule are all optional and are as follows:

active if true then this rule is applied, if false then this rule is ignored. If not specified then it defaults to "true"

bold if true then any characters that match this rule are made bold. If not specified then it defaults to "false"

underline if true then any characters that match this rule are underlines. If not specified then it defaults to "false"

italic if true then any characters that match this rule are made italic. If not specified then it defaults to "false"

color if true then any characters that match this rule have their fore colour set to this value. It can either be a word for the most common colours (blue, red, green, darkblue, etc) or it can be a hex code. If not specified then it defaults to "black". If you specify an invalid colour name or code then ChromaCode will throw an exception when the rule file is loaded and parsed

Rule Characters

The list of characters that the rule should apply to are placed within the <characters></characters> tags. The list of characters should be space seperated or on seperate lines. You do not need to place then in the <![CDATA[]]> tag but this is recommeded to ensure that the XML parser does not try to validate any of your characters and will just read the data "as is".

Last edited May 4, 2011 at 10:54 PM by NybbleUK, version 3

Comments

No comments yet.