Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/indispensable.git
#LyX 1.6.7 created this file. For more info see http://www.lyx.org/
\lyxformat 345
\begin_document
\begin_header
\textclass scrbook
\begin_preamble
\input{preamble.tex}
\end_preamble
\use_default_options false
\language english
\inputencoding utf8
\font_roman lmodern
\font_sans helvet
\font_typewriter courier
\font_default_family default
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100

\graphics default
\float_placement H
\paperfontsize default
\spacing single
\use_hyperref true
\pdf_bookmarks true
\pdf_bookmarksnumbered false
\pdf_bookmarksopen false
\pdf_bookmarksopenlevel 1
\pdf_breaklinks false
\pdf_pdfborder false
\pdf_colorlinks false
\pdf_backref false
\pdf_pdfusetitle true
\papersize letterpaper
\use_geometry false
\use_amsmath 2
\use_esint 1
\cite_engine basic
\use_bibtopic false
\paperorientation portrait
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\defskip medskip
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\bullet 0 5 11 -1
\bullet 1 5 24 -1
\bullet 2 0 0 -1
\tracking_changes false
\output_changes false
\author "" 
\author "" 
\end_header

\begin_body

\begin_layout Standard
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
input{chapter.tex}
\end_layout

\end_inset


\end_layout

\begin_layout Chapter
\begin_inset CommandInset label
LatexCommand label
name "cha:Style"

\end_inset

Style Templates
\end_layout

\begin_layout Standard
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
epigraph{The best programmers are not marginally better than merely good
 ones.
 They are an order-of-magnitude better, measured by whatever standard: conceptua
l creativity, speed, ingenuity of design, or problem-solving ability.}{Randall
 E.
 Stross}
\end_layout

\end_inset


\end_layout

\begin_layout Standard
Great software developers can look at system and see areas where duplication
 will:
\end_layout

\begin_layout Itemize
be a maintenance burden;
\end_layout

\begin_layout Itemize
affect perception of quality due to inconsistencies; and
\end_layout

\begin_layout Itemize
negatively affect performance.
\end_layout

\begin_layout Standard
More importantly, when the duplicated areas are identified, such developers
 immediately see solutions to eliminate the repetition.
 The developers who helped create 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appireport{}
\end_layout

\end_inset

 implemented a number of features to avoid duplication when writing reports.
 Of all these features, style templates and resource bundles are probably
 the most effective tools for avoiding duplication.
 Style templates are the subject of this chapter; resource bundles will
 be discussed in the next chapter.
\end_layout

\begin_layout Standard
Style templates do more than allow developers to codify the feel of the
 report in a single location (for example, colours, line thickness, fonts).
 Style templates also allow developers to encode how elements on the report
 look (for example, date format, currency).
\end_layout

\begin_layout Standard
In this chapter:
\end_layout

\begin_layout Itemize

\series bold
Style Template Names.

\series default
 Sensible names that future maintainers will love.
 
\end_layout

\begin_layout Itemize

\series bold
New Style Template.

\series default
 Steps to create a style template.
 
\end_layout

\begin_layout Itemize

\series bold
Look.

\series default
 Give all reports the same look (fonts, date format, etc.) in one location.
 
\end_layout

\begin_layout Itemize

\series bold
Fonts.

\series default
 Embedding fonts and reducing PDF file size.
\end_layout

\begin_layout Itemize

\series bold
Images.

\series default
 Differences in file formats, words on optimization, and normalization.
\end_layout

\begin_layout Itemize

\series bold
Standards.

\series default
 Creating a consistent look to the reports.
 
\end_layout

\begin_layout Itemize

\series bold
Layers.
 
\series default
Avoid duplicating 
\series bold
PrintWhenExpression
\series default
 statements.
\end_layout

\begin_layout Itemize

\series bold
Formatting Tools.

\series default
 A brief overview of 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appireport{}
\end_layout

\end_inset

's arsenal to expedite development.
\end_layout

\begin_layout Section
Style Template Names
\end_layout

\begin_layout Standard
Consistent widespread use of style templates will expedite changes to fonts
 and patterned text (such as dates and numbers).
 Use the styles listed in 
\begin_inset CommandInset ref
LatexCommand ref
reference "tab:Well-Named-Styles"

\end_inset

 as a guideline.
\end_layout

\begin_layout Standard
\begin_inset Float table
placement H
wide false
sideways false
status collapsed

\begin_layout Plain Layout
\begin_inset Caption

\begin_layout Plain Layout
\begin_inset CommandInset label
LatexCommand label
name "tab:Well-Named-Styles"

\end_inset

Style Names (Good)
\end_layout

\end_inset


\begin_inset Tabular
<lyxtabular version="3" rows="22" columns="2">
<features>
<column alignment="left" valignment="top" width="0">
<column alignment="left" valignment="top" width="0">
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
rowcolor{tableheader}
\backslash
toprule{}
\end_layout

\end_inset


\series bold
Style Name
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\series bold
Description
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
midrule{}
\end_layout

\end_inset

ReportParagraph
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Text formatting for paragraphs
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
ReportTitle 
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Header page text 
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
ReportSubtitle 
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Text below the header 
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
PageTitle 
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Text along top of each page (after title page) 
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Parameter 
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Parent class for child parameter styles 
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Footer 
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Parent class for footer styles 
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
ReportDate 
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Parent class for date pattern 
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
ReportTimestamp 
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Parent class for date and time pattern 
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
ReportPage
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Page X of Y in footer 
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
ParameterName 
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Input parameters 
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
ParameterValue 
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Input parameter values (usually selected by user) 
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
ParameterDate 
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Input parameter date values (also user selected) 
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
ColumnName 
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Column header 
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
ColumnValue 
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Column value (most of the report content) 
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
ColumnNumeric 
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Column value (to control justification of numbers) 
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
ColumnDate 
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Date format for 
\family typewriter
java.util.Date
\family default
 values 
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
ColumnTimestamp 
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Date and time format for 
\family typewriter
java.sql.Timestamp
\family default
 values 
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
ZebraStripe 
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Controls alternate row colour 
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Divider 
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Default thickness and style for lines 
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
DividerTitle 
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Line used in the title page 
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
DividerGroup
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Line used to separate distinct groups
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
tabularnewline
\backslash
bottomrule%
\end_layout

\end_inset


\end_layout

\end_inset
</cell>
</row>
</lyxtabular>

\end_inset


\end_layout

\end_inset


\end_layout

\begin_layout Standard
You may find you will need to add styles, or that some styles do not apply.
 In both cases, the values are to be treated as constants with names that
 reflect their usage, not their application.
 The style names listed in 
\begin_inset CommandInset ref
LatexCommand ref
reference "tab:Poorly-Named-Styles"

\end_inset

, for example, are inappropriate as they offer little meaning of their use,
 and if the style changes, their names become misleading.
\end_layout

\begin_layout Standard
\begin_inset Float table
wide false
sideways false
status collapsed

\begin_layout Plain Layout
\begin_inset Caption

\begin_layout Plain Layout
\begin_inset CommandInset label
LatexCommand label
name "tab:Poorly-Named-Styles"

\end_inset

Style Names (Bad)
\end_layout

\end_inset


\begin_inset Tabular
<lyxtabular version="3" rows="4" columns="2">
<features>
<column alignment="left" valignment="top" width="0">
<column alignment="left" valignment="top" width="0">
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
rowcolor{tableheader}
\backslash
toprule{}
\end_layout

\end_inset


\series bold
Style Name
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\series bold
Description
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
midrule{}
\end_layout

\end_inset

BoldColumns
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Column headers
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
DottedLine
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Separate (divide) groups
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
DateDDMMYY
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Date format
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
tabularnewline
\backslash
bottomrule%
\end_layout

\end_inset


\end_layout

\end_inset
</cell>
</row>
</lyxtabular>

\end_inset


\end_layout

\end_inset


\end_layout

\begin_layout Standard
It is easy to understand that changing the date pattern from two- to four-digit
 years makes 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
nohyphens{DateDDMMYY}
\end_layout

\end_inset

 misleading.
 Morever, potentially having to change all uses of that style name (for
 example, from 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
nohyphens{DateDDMMYY}
\end_layout

\end_inset

 to 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
nohyphens{DateDDMMYYYY}
\end_layout

\end_inset

) in hundreds of reports defeats the purpose of styles altogether.
\end_layout

\begin_layout Section
\begin_inset CommandInset label
LatexCommand label
name "sec:New-Style-Template"

\end_inset

New Style Template
\end_layout

\begin_layout Standard
Create a new style template as follows:
\end_layout

\begin_layout Enumerate
Click 
\series bold
File 
\begin_inset Quotes ald
\end_inset

 New
\series default
.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Style
\series default
.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Finish
\series default
.
\end_layout

\begin_deeper
\begin_layout Standard
The 
\series bold
Style Template
\series default
 dialog appears (
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:Create-New-Style"

\end_inset

).
\end_layout

\end_deeper
\begin_layout Standard
\begin_inset Float figure
wide false
sideways false
status collapsed

\begin_layout Plain Layout
\begin_inset Graphics
	filename captures/ireport-new-template.png
	display false

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Caption

\begin_layout Plain Layout
\begin_inset CommandInset label
LatexCommand label
name "fig:Create-New-Style"

\end_inset

Create New Style Template
\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\begin_layout Standard
At this point, you have a new file that describes how all reports should
 look when exported to a PDF file.
 The style template is empty.
 The remaining sections in this chapter will guide you through adding content.
\end_layout

\begin_layout Section
Look
\end_layout

\begin_layout Standard
The look of a report includes choice of fonts, how text is formatted, thickness
 of lines, layout, and colour.
 This section describes ways of making only consistent use of these items,
 and applying them across multiple reports from a single definition file:
 the style template.
\end_layout

\begin_layout Subsection
Text
\end_layout

\begin_layout Standard
This section describes how to apply the same font size, padding, and colour
 to column headings.
 After completing the steps in 
\begin_inset CommandInset ref
LatexCommand ref
reference "sec:New-Style-Template"

\end_inset

, perform the following tasks:
\end_layout

\begin_layout Enumerate
Click 
\series bold
Window 
\begin_inset Quotes ald
\end_inset

 Template Inspector
\series default
 to open the Template Inspector panel.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
New style
\series default
 to select it.
 
\end_layout

\begin_layout Enumerate
Press 
\series bold
F2
\series default
 (or double click, or right-click and select 
\series bold
Rename
\series default
) to rename the defined style.
 
\end_layout

\begin_layout Enumerate
Type: 
\family typewriter
ColumnName
\family default
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Window 
\begin_inset Quotes ald
\end_inset

 Properties
\series default
 to open the 
\series bold
Properties
\series default
 panel.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
ColumnName
\series default
 to select it.
\end_layout

\begin_deeper
\begin_layout Standard
The 
\series bold
Properties
\series default
 panel is updated.
\end_layout

\end_deeper
\begin_layout Enumerate
Set 
\series bold
Size
\series default
 to 16.
\end_layout

\begin_layout Enumerate
Click the button beside 
\series bold
Padding and borders
\series default
.
 
\end_layout

\begin_layout Enumerate
Change the 
\series bold
Left
\series default
 and 
\series bold
Right 
\series default
values to 2 (
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:Padding-and-Borders-Dialog"

\end_inset

).
\end_layout

\begin_deeper
\begin_layout Standard
\begin_inset Float figure
placement H
wide false
sideways false
status collapsed

\begin_layout Plain Layout
\begin_inset Graphics
	filename captures/ireport-padding-and-borders.png
	display false

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Caption

\begin_layout Plain Layout
\align center
\begin_inset CommandInset label
LatexCommand label
name "fig:Padding-and-Borders-Dialog"

\end_inset

Padding and Borders Dialog
\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\end_deeper
\begin_layout Enumerate
Click 
\series bold
OK
\series default
 to accept the new padding values.
 
\end_layout

\begin_layout Enumerate
Click the button beside 
\series bold
Forecolor
\series default
 to change the default font colour (
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:Foreground-Colour-Selection-Dialog"

\end_inset

).
\end_layout

\begin_deeper
\begin_layout Standard
\begin_inset Float figure
placement H
wide false
sideways false
status collapsed

\begin_layout Plain Layout
\begin_inset Graphics
	filename captures/ireport-forecolor.png
	display false

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Caption

\begin_layout Plain Layout
\align center
\begin_inset CommandInset label
LatexCommand label
name "fig:Foreground-Colour-Selection-Dialog"

\end_inset

Foreground Colour Selection Dialog
\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\end_deeper
\begin_layout Enumerate
Pick a foreground colour.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
OK
\series default
 to accept the new colour.
 
\end_layout

\begin_layout Enumerate
Save the style template as 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filejrtxpdf}
\end_layout

\end_inset

 in the styles directory (refer to 
\begin_inset CommandInset ref
LatexCommand vref
reference "tab:Report-Parameter-Values"

\end_inset

 for path details).
 
\end_layout

\begin_layout Standard
Any value shown in the 
\series bold
Properties
\series default
 panel can be updated.
 When satisfied with the changes to the style template, apply the style
 template to the city report as follows:
\end_layout

\begin_layout Enumerate
Open the file 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filejrxmlcity}
\end_layout

\end_inset

 (see 
\begin_inset CommandInset ref
LatexCommand vref
reference "sub:\\filejrxmlcity"

\end_inset

).
\end_layout

\begin_layout Enumerate
Click 
\series bold
Window 
\begin_inset Quotes ald
\end_inset

 Report Inspector
\series default
 to reveal the 
\series bold
Report Inspector
\series default
 panel.
 
\end_layout

\begin_layout Enumerate
Right-click 
\series bold
Styles
\series default
.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Add 
\begin_inset Quotes ald
\end_inset

 Style Reference
\series default
.
 
\end_layout

\begin_layout Enumerate
Select 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filejrtxpdf}
\end_layout

\end_inset

.
\end_layout

\begin_layout Enumerate
Click 
\series bold
Open
\series default
.
 
\end_layout

\begin_layout Standard
At this point, the style template is associated with the city report.
 The 
\series bold
Source Expression
\series default
, however, is a hard-coded path to the file.
\end_layout

\begin_layout Standard
Complete the following steps:
\end_layout

\begin_layout Enumerate
If not already defined, add the 
\family typewriter
ROOT_DIR
\family default
 and 
\family typewriter
STYLE_DIR
\family default
 parameters (defined in 
\begin_inset CommandInset ref
LatexCommand ref
reference "tab:Report-Parameter-Values"

\end_inset

) to 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filejrxmlcity}
\end_layout

\end_inset

.
\end_layout

\begin_layout Enumerate
Click 
\series bold
Window 
\begin_inset Quotes ald
\end_inset

 Properties
\series default
 to display the 
\series bold
Properties
\series default
 panel.
 
\end_layout

\begin_layout Enumerate
Select the style template (
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:Selected-Style-Template"

\end_inset

).
\end_layout

\begin_deeper
\begin_layout Standard
\begin_inset Float figure
placement H
wide false
sideways false
status collapsed

\begin_layout Plain Layout
\begin_inset Graphics
	filename captures/ireport-select-style-template.png
	display false

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Caption

\begin_layout Plain Layout
\begin_inset CommandInset label
LatexCommand label
name "fig:Selected-Style-Template"

\end_inset

Selected Style Template
\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\end_deeper
\begin_layout Enumerate
Click the button beside 
\series bold
Source Expression
\series default
 to open the 
\series bold
Source Expression
\series default
 editor dialog.
 
\end_layout

\begin_layout Enumerate
Change the 
\series bold
Source Expression
\series default
 in the 
\series bold
Properties
\series default
 panel for the Template to: 
\end_layout

\begin_deeper
\begin_layout LyX-Code

\family typewriter
$P{STYLE_DIR} + "
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filejrtxpdf
\end_layout

\end_inset

"
\end_layout

\end_deeper
\begin_layout Enumerate
Click 
\series bold
OK 
\series default
to accept the changes.
\end_layout

\begin_layout Enumerate
Select the 
\series bold
id
\series default
 column in the report designer.
\end_layout

\begin_deeper
\begin_layout Standard
The 
\series bold
Properties
\series default
 panel will update.
\end_layout

\end_deeper
\begin_layout Enumerate
Click the drop-down beside 
\series bold
Style
\series default
.
 
\end_layout

\begin_layout Enumerate
Select 
\series bold
ColumnName
\series default
.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Preview
\series default
.
\end_layout

\begin_layout Standard
The 
\series bold
id
\series default
 column has disappeared! This is because the band height for the column
 header and the height given to the 
\series bold
id
\series default
 column header field are too small to contain the result.
\end_layout

\begin_layout Standard
To resize the 
\series bold
id
\series default
 column:
\end_layout

\begin_layout Enumerate
Set the band height to 30 pixels.
 
\end_layout

\begin_layout Enumerate
Set the height of the 
\series bold
id
\series default
 column to 30 pixels.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Preview
\series default
.
\end_layout

\begin_layout Standard
The results appear as in 
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:Cities-Report-with-Applied-Style"

\end_inset

.
 
\end_layout

\begin_layout Standard
\begin_inset Float figure
wide false
sideways false
status collapsed

\begin_layout Plain Layout
\begin_inset Graphics
	filename captures/ireport-apply-template-01.png
	display false

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Caption

\begin_layout Plain Layout
\align center
\begin_inset CommandInset label
LatexCommand label
name "fig:Cities-Report-with-Applied-Style"

\end_inset

Report - Cities with Applied Style
\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\begin_layout Standard
To apply the same formatting to the remaining columns quickly, do the following:
\end_layout

\begin_layout Enumerate
Expand 
\series bold
Column Header
\series default
 in the 
\series bold
Report Inspector
\series default
.
 
\end_layout

\begin_layout Enumerate
Click the 
\series bold
name
\series default
 field.
 
\end_layout

\begin_layout Enumerate
Hold the shift key and click the 
\series bold
longitude
\series default
 field.
 
\end_layout

\begin_layout Enumerate
In the 
\series bold
Multiple Objects -- Properties
\series default
 dialog, use the following settings:
\end_layout

\begin_deeper
\begin_layout Enumerate
Height: 30
\end_layout

\begin_layout Enumerate
Style: 
\series bold
ColumnName
\end_layout

\end_deeper
\begin_layout Enumerate
Click 
\series bold
Preview
\series default
.
 
\end_layout

\begin_layout Standard
All the columns are now the same style as the 
\series bold
id
\series default
 column.
\end_layout

\begin_layout Standard
To change all the columns simultaneously:
\end_layout

\begin_layout Enumerate
Open 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filejrtxpdf}
\end_layout

\end_inset

.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Window 
\begin_inset Quotes ald
\end_inset

 Template Inspector
\series default
 to display the 
\series bold
Template Inspector
\series default
 panel.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
ColumnName
\series default
 to select it.
\end_layout

\begin_deeper
\begin_layout Standard
The 
\series bold
Properties
\series default
 panel shows the corresponding settings.
\end_layout

\end_deeper
\begin_layout Enumerate
Change 
\series bold
Forecolor
\series default
 to another colour.
 
\end_layout

\begin_layout Enumerate
Save the file.
 
\end_layout

\begin_layout Enumerate
Open 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filejrxmlcity}
\end_layout

\end_inset

.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Preview
\series default
.
 
\end_layout

\begin_layout Enumerate
Click the 
\series bold
Run Again
\series default
 icon to refresh the report.
 
\end_layout

\begin_layout Standard
All the columns use the new colour.
\end_layout

\begin_layout Subsection
Formatted Text
\end_layout

\begin_layout Standard
In 
\begin_inset CommandInset ref
LatexCommand vref
reference "sec:Text-Formatting"

\end_inset

 is a statement that formatting column values is best left to the report,
 rather than the SQL statement.
 This section describes how to accomplish this using a 
\emph on
style template
\emph default
.
 There are two common situations where isolating the formatting applied
 to information will reduce maintenance: dates and numeric values.
 This section describes how to apply formatting for the trickier of the
 two: dates.
\end_layout

\begin_layout Standard
There is an issue with 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appireport{}
\end_layout

\end_inset

 that takes a while to figure out.
 When editing an existing report, specifically, a report that already has
 dates within it, applying a style to those dates is not straightforward.
 There are many steps and many details that must be resolved (until such
 time as an 
\series bold
Override Style
\series default
 checkbox is added to the 
\series bold
Properties
\series default
 panel).
 The crux of the problem, then, is that styles are overridden automatically.
\end_layout

\begin_layout Standard
To see the problem and learn how to fix it:
\begin_inset Foot
status collapsed

\begin_layout Plain Layout
I have not attempted to duplicate this problem in 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appireport{}
\end_layout

\end_inset

 4.0.0.
\end_layout

\end_inset


\end_layout

\begin_layout Enumerate
Add a date.
 
\end_layout

\begin_layout Enumerate
Change its style.
 This emulates the situation where a date already exists in a report.
 
\end_layout

\begin_layout Enumerate
Add a style to the Style Template.
 
\end_layout

\begin_layout Enumerate
Apply that style to the date.
 
\end_layout

\begin_layout Enumerate
Remove the existing pattern format.
\end_layout

\begin_deeper
\begin_layout Standard
This illustrates a step that does not work, but seems like it should.
 In practice you can skip to the next step.
\end_layout

\end_deeper
\begin_layout Enumerate
Delete the 
\series bold
textField
\series default
 element's 
\series bold
pattern
\series default
 attribute in the XML.
 
\end_layout

\begin_layout Standard
To add a date to the city report and apply a format, complete the following
 steps: 
\end_layout

\begin_layout Enumerate
Open 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filejrxmlcity}
\end_layout

\end_inset

.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Window 
\begin_inset Quotes ald
\end_inset

 Palette
\series default
 to display the Palette panel.
 
\end_layout

\begin_layout Enumerate

\emph on
Drag and drop
\emph default
 the 
\series bold
Current date
\series default
 into the 
\series bold
Page Footer
\series default
.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Apply
\series default
 to close the 
\series bold
Pattern editor
\series default
 dialog.
 
\end_layout

\begin_layout Standard
Take special note of this procedure; if you are not careful, it will be
 the source of future headaches.
 Even though the pattern will eventually be applied using the style template,
 this sequence of steps creates a pattern that will overrule any attempt
 to apply a style from a style template.
\end_layout

\begin_layout Standard
To set a date pattern, complete the following steps:
\end_layout

\begin_layout Enumerate
Optionally, set the 
\series bold
Page Footer
\series default
 band height to 20.
 
\end_layout

\begin_layout Enumerate
Open 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filejrtxpdf}
\end_layout

\end_inset

.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Window 
\begin_inset Quotes ald
\end_inset

 Template Inspector
\series default
 to display the Template Inspector panel.
 
\end_layout

\begin_layout Enumerate
Right-click 
\series bold
Styles
\series default
.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Add 
\begin_inset Quotes ald
\end_inset

 Style
\series default
.
 
\end_layout

\begin_layout Enumerate
Rename 
\series bold
Style_1
\series default
 to 
\series bold
ReportDate
\series default
.
 
\end_layout

\begin_layout Enumerate
Click the button beside 
\series bold
Pattern
\series default
 in the 
\series bold
Properties
\series default
 panel.
 
\end_layout

\begin_layout Enumerate
Select the pattern shown in 
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:Style-Template-Pattern-Selection"

\end_inset

.
\end_layout

\begin_deeper
\begin_layout Standard
\begin_inset Float figure
wide false
sideways false
status collapsed

\begin_layout Plain Layout
\begin_inset Graphics
	filename captures/ireport-style-date.png
	display false

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Caption

\begin_layout Plain Layout
\align center
\begin_inset CommandInset label
LatexCommand label
name "fig:Style-Template-Pattern-Selection"

\end_inset

Style Template Pattern Selection
\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\end_deeper
\begin_layout Enumerate
Click 
\series bold
OK
\series default
 to accept the date pattern.
 
\end_layout

\begin_layout Enumerate
Save the style template file.
 
\end_layout

\begin_layout Enumerate
Click on the 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filejrxmlcity}
\end_layout

\end_inset

 tab.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Preview
\series default
.
 
\end_layout

\begin_layout Enumerate
Scroll to the bottom of the page.
 
\end_layout

\begin_layout Standard
The date does not appear in the format selected in 
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:Style-Template-Pattern-Selection"

\end_inset

 until after the style is successfully applied.
 Apply the style as follows:
\end_layout

\begin_layout Enumerate
Click the date field in the Page Footer to select it.
 
\end_layout

\begin_layout Enumerate
Click the drop-down beside 
\series bold
Style
\series default
 in the 
\series bold
Properties
\series default
 panel.
 
\end_layout

\begin_layout Standard
The 
\series bold
ReportDate
\series default
 style is not present, because the style list did not get refreshed.
 To refresh the style list:
\end_layout

\begin_layout Enumerate
Close the 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filejrxmlcity}
\end_layout

\end_inset

 tab.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Save
\series default
 if prompted to save changes.
 
\end_layout

\begin_layout Enumerate
Reopen 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filejrxmlcity}
\end_layout

\end_inset

.
 
\end_layout

\begin_layout Enumerate
Click to select the date field in the 
\series bold
Page Footer
\series default
.
\end_layout

\begin_layout Enumerate
Click the drop-down beside 
\series bold
Style
\series default
 in the 
\series bold
Properties
\series default
 panel.
 
\end_layout

\begin_layout Enumerate
Select 
\series bold
ReportDate
\series default
.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Preview
\series default
.
 
\end_layout

\begin_layout Enumerate
Scroll to the bottom of the page.
 
\end_layout

\begin_layout Standard
The date still does not appear in the selected format.
 When the date was dragged onto the report, a default date pattern was set,
 shown in 
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:Default-Date-Style"

\end_inset

.
\end_layout

\begin_layout Standard
\begin_inset Float figure
wide false
sideways false
status collapsed

\begin_layout Plain Layout
\begin_inset Graphics
	filename captures/ireport-default-date-style.png
	display false

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Caption

\begin_layout Plain Layout
\begin_inset CommandInset label
LatexCommand label
name "fig:Default-Date-Style"

\end_inset

Default Date Style
\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\begin_layout Standard
To remove the default date pattern:
\end_layout

\begin_layout Enumerate
Delete the value for the 
\series bold
Pattern
\series default
 (remove the text).
\end_layout

\begin_layout Enumerate
Click 
\series bold
Preview
\series default
.
 
\end_layout

\begin_layout Enumerate
Scroll to the bottom of the page.
\end_layout

\begin_layout Standard
You might expect the date to resemble the pattern selected in 
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:Style-Template-Pattern-Selection"

\end_inset

, but it does not.
 To fix the date:
\end_layout

\begin_layout Enumerate
Click 
\series bold
XML
\series default
 (beside 
\series bold
Preview
\series default
).
 
\end_layout

\begin_layout Enumerate
Scroll to the bottom of the XML file until the lines in 
\begin_inset CommandInset ref
LatexCommand ref
reference "alg:Text-Field-Element"

\end_inset

 appear.
\end_layout

\begin_deeper
\begin_layout Standard
\begin_inset Float algorithm
wide false
sideways false
status open

\begin_layout Plain Layout
\begin_inset Graphics
	filename source/xml/textfield.xml.png
	display false

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Caption

\begin_layout Plain Layout
\begin_inset CommandInset label
LatexCommand label
name "alg:Text-Field-Element"

\end_inset

Text Field Element
\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\end_deeper
\begin_layout Enumerate
Change the first line (remove the 
\family typewriter
pattern
\family default
 attribute) to: 
\end_layout

\begin_deeper
\begin_layout LyX-Code

\family typewriter
<textField>
\end_layout

\end_deeper
\begin_layout Enumerate
Click 
\series bold
Preview
\series default
.
 
\end_layout

\begin_layout Enumerate
Scroll to the bottom of the page.
\end_layout

\begin_layout Standard
You are not quite there yet; one more change is required.
\end_layout

\begin_layout Standard
To apply the report date, complete the following steps:
\end_layout

\begin_layout Enumerate
Click the drop-down beside 
\series bold
Style
\series default
 in the 
\series bold
Properties
\series default
 panel.
 
\end_layout

\begin_layout Enumerate
Select 
\series bold
ColumnName
\series default
.
 
\end_layout

\begin_layout Enumerate
Click the drop-down beside 
\series bold
Style
\series default
 in the 
\series bold
Properties
\series default
 panel.
 
\end_layout

\begin_layout Enumerate
Select 
\series bold
ReportDate
\series default
.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Preview
\series default
.
 
\end_layout

\begin_layout Enumerate
Scroll to the bottom of the page.
 
\end_layout

\begin_layout Standard
Finally, success! This situation will re-appear when editing existing reports.
\end_layout

\begin_layout Standard
The last minor detail is to change the field width so that the full time
 stamp is displayed.
 There are a couple of ways to do this:
\end_layout

\begin_layout Itemize

\series bold
Manual change.

\series default
 Set the field width to 140 pixels.
 
\end_layout

\begin_layout Itemize

\series bold
Adapt to parent.

\series default
 Set the width of the field to the entire width of the 
\series bold
Page Footer
\series default
 as follows: 
\end_layout

\begin_deeper
\begin_layout Enumerate
Open the 
\series bold
Formatting Tools Window
\series default
 panel.
\end_layout

\begin_layout Enumerate
Select the date field.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Adapt to parent width
\series default
.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Preview
\series default
.
 
\end_layout

\end_deeper
\begin_layout Standard
Adapting to the parent width is a useful technique, because it ensures the
 text is always displayed.
 As text fields (and static text) can be placed on top of existing text
 (due to text fields being transparent by default), you need only be wary
 of placing fields too close together.
\end_layout

\begin_layout Standard
Some places in the world use month-day-year for dates while others use day-month
-year.
 Some people prefer a 24-hour time format where others prefer to read time
 with 
\shape smallcaps
AM
\shape default
 and 
\shape smallcaps
PM
\shape default
.
 By using a style template, any decision can be changed with ease.
 Style templates also allow a consistent application of internationalization
 rules across all reports.
\end_layout

\begin_layout Standard
As an exercise for the reader, try to make right-justified numbers using
 a style template.
\end_layout

\begin_layout Subsection
Multiple Style Templates
\end_layout

\begin_layout Standard
The beauty behind setting up a style template and using the variables defined
 in 
\begin_inset CommandInset ref
LatexCommand vref
reference "tab:Report-Parameter-Values"

\end_inset

 is the simplicity in completely changing the style of all reports by substituti
ng one style template for another.
 A classic example is print media versus display media.
\end_layout

\begin_layout Standard
On the printed page, a serif font (such as Times New Roman) is easier to
 read than a non-serif font (such as Arial).
 Whereas on a screen, the reverse is true.
 It should not be a time-consuming task to offer this ability to the report
 users.
\end_layout

\begin_layout Standard
When you have consistently named and applied various styles across all the
 reports (see 
\begin_inset CommandInset ref
LatexCommand vref
reference "tab:Well-Named-Styles"

\end_inset

), you can do the following:
\end_layout

\begin_layout Enumerate
Create a new style template using the same style names.
 
\end_layout

\begin_layout Enumerate
Change the styles in the style template to reflect the desired outcome.
 
\end_layout

\begin_layout Enumerate
Update the template's 
\series bold
Source Expression
\series default
 to reference a second parameter:
\end_layout

\begin_deeper
\begin_layout Enumerate
Edit the expression:
\end_layout

\begin_deeper
\begin_layout LyX-Code

\family typewriter
$P{STYLE_DIR} + "
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filejrtxpdf
\end_layout

\end_inset

"
\end_layout

\end_deeper
\begin_layout Enumerate
Change the expression to:
\end_layout

\begin_deeper
\begin_layout LyX-Code

\family typewriter
$P{STYLE_DIR} + $P{STYLE_TEMPLATE} + "
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
fileextjrtx
\end_layout

\end_inset

"
\end_layout

\end_deeper
\begin_layout Enumerate
Add a parameter named 
\family typewriter
STYLE_TEMPLATE
\family default
.
\end_layout

\begin_layout Enumerate
Assign 
\family typewriter
STYLE_TEMPLATE
\family default
 a default value:
\end_layout

\begin_deeper
\begin_layout LyX-Code

\family typewriter
"
\family default
pdf
\family typewriter
"
\end_layout

\end_deeper
\end_deeper
\begin_layout Standard
To change the template used when generating the report, set the 
\family typewriter
STYLE_TEMPLATE
\family default
 parameter to the corresponding file name (without the extension).
\end_layout

\begin_layout Section
Fonts
\end_layout

\begin_layout Standard
This section describes how to embed fonts inside a PDF.
 The process can be as simple as archiving and embedding, or as involved
 as trimming down the font to its bare essentials.
 After reading this section, you will be able to do the following:
\end_layout

\begin_layout Itemize
Edit existing TrueType fonts.
 
\end_layout

\begin_layout Itemize
Archive TrueType fonts.
 
\end_layout

\begin_layout Itemize
Embed TrueType fonts inside PDF files.
\end_layout

\begin_layout Subsection
\begin_inset CommandInset label
LatexCommand label
name "sub:Style-Editing"

\end_inset

Editing
\end_layout

\begin_layout Standard
This section describes how to remove unused font characters (called glyphs)
 from TrueType font files.
 Font files can range in size from several kilobytes to half a megabyte
 or more.
 Without due care, embedding fonts can significantly increase the size of
 the resulting PDF file, which means greater bandwidth use, slower download
 speeds, and slower rendering times.
 However, most font files contain characters that are not used in PDF files.
 Removing the unused characters reduces the size of the font file and thus
 the final size of the PDF file.
\end_layout

\begin_layout Standard
Before editing any font, make a backup copy of the font file.
\end_layout

\begin_layout Standard
For the purposes of this example, download the free font Liberation Sans
 from Red Hat,
\begin_inset Foot
status collapsed

\begin_layout Plain Layout
\begin_inset CommandInset href
LatexCommand href
target "http://fedorahosted.org/liberation-fonts"

\end_inset


\end_layout

\end_inset

 in binary (TrueType) format, and remove the unused characters as follows:
\end_layout

\begin_layout Enumerate
In Windows, use 7-Zip to extract the contents of the 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
fileexttargz}
\end_layout

\end_inset

 file.
\end_layout

\begin_layout Enumerate
Use 7-Zip to extract contents of the 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
fileexttar}
\end_layout

\end_inset

 file.
\end_layout

\begin_layout Enumerate
Copy 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filefontregular}
\end_layout

\end_inset

 to the fonts directory (see 
\begin_inset CommandInset ref
LatexCommand vref
reference "fig:Example-Directory-Organization"

\end_inset

).
 
\end_layout

\begin_layout Enumerate
Start FontForge.
\end_layout

\begin_layout Enumerate
Open 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filefontregular}
\end_layout

\end_inset

.
 
\end_layout

\begin_layout Enumerate
Resize the window to show more glyphs.
 
\end_layout

\begin_layout Enumerate
Click on the space character and drag to highlight up to the tilde (~),
 as in 
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:FontForge-Selected-Characters"

\end_inset

.
\begin_inset Foot
status collapsed

\begin_layout Plain Layout
Clicking while holding the shift key does not allow range selection.
\end_layout

\end_inset


\end_layout

\begin_deeper
\begin_layout Standard
\begin_inset Float figure
wide false
sideways false
status collapsed

\begin_layout Plain Layout
\begin_inset Graphics
	filename captures/font-edit-02.png

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Caption

\begin_layout Plain Layout
\begin_inset CommandInset label
LatexCommand label
name "fig:FontForge-Selected-Characters"

\end_inset

FontForge Selected Characters
\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\end_deeper
\begin_layout Enumerate
Click 
\series bold
Edit 
\begin_inset Quotes ald
\end_inset

 Select 
\begin_inset Quotes ald
\end_inset

 Invert Selection
\series default
 to select the characters to remove.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Encoding 
\begin_inset Quotes ald
\end_inset

 Detach & Remove Glyphs
\series default
 to delete the unused characters.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Remove
\series default
 to confirm.
 
\end_layout

\begin_layout Enumerate
Accept any errors that appear.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Encoding 
\begin_inset Quotes ald
\end_inset

 Compact
\series default
.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
File 
\begin_inset Quotes ald
\end_inset

 Generate Fonts
\series default
 to open the 
\series bold
Generate Fonts
\series default
 dialog.
 
\end_layout

\begin_layout Enumerate
Change the type from 
\series bold
PS Type 1 (Binary)
\series default
 to 
\series bold
TrueType
\series default
.
 
\end_layout

\begin_layout Enumerate
Name the file 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filefontregularstripped}
\end_layout

\end_inset

.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Save
\series default
.
\end_layout

\begin_layout Standard
Verify the results by comparing the file sizes.
 At the time of writing, the resulting file sizes were:
\end_layout

\begin_layout Itemize
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filefontregular}
\end_layout

\end_inset

 -- 149 kilobytes 
\end_layout

\begin_layout Itemize
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filefontregularstripped}
\end_layout

\end_inset

 -- 37 kilobytes 
\end_layout

\begin_layout Standard
The savings of 112 kilobytes is larger than the final result, as will be
 seen at the end of this chapter.
 Still, it is a substantial reduction that can save bandwidth costs while
 providing end users with a PDF file that uses a minimalist high-quality
 font.
 Moreover, the smaller size will decrease download time and load time for
 the PDF file, giving end users a better experience overall.
\end_layout

\begin_layout Subsection
\begin_inset CommandInset label
LatexCommand label
name "sub:Archiving"

\end_inset

Archiving
\end_layout

\begin_layout Standard
To use the minimal font created in the previous section, you must create
 a Java Archive (
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
fileextjar}
\end_layout

\end_inset

) file and add the file to Java's CLASSPATH.
 To create a Java Archive file:
\end_layout

\begin_layout Enumerate
Start 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appireport{}
\end_layout

\end_inset

.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Tools 
\begin_inset Quotes ald
\end_inset

 Options
\series default
.
 
\end_layout

\begin_layout Enumerate
Click the 
\series bold
Fonts
\series default
 tab (
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:iReport-Fonts-Tab"

\end_inset

).
\end_layout

\begin_deeper
\begin_layout Standard
\begin_inset Float figure
wide false
sideways false
status collapsed

\begin_layout Plain Layout
\begin_inset Graphics
	filename captures/ireport-fonts-tab.png

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Caption

\begin_layout Plain Layout
\begin_inset CommandInset label
LatexCommand label
name "fig:iReport-Fonts-Tab"

\end_inset

 Fonts Tab
\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\end_deeper
\begin_layout Enumerate
Click 
\series bold
Install Font
\series default
.
\end_layout

\begin_layout Enumerate
Click 
\series bold
Browse
\series default
.
 
\end_layout

\begin_layout Enumerate
Find and select 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filefontregularstripped}
\end_layout

\end_inset

.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Open
\series default
.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Next
\series default
.
 
\end_layout

\begin_layout Enumerate
Check 
\series bold
Embed this font in the PDF document
\series default
.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Finish
\series default
.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Liberation Serif
\series default
.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Export as extension
\series default
.
 
\end_layout

\begin_layout Enumerate
Browse to the 
\series bold
fonts
\series default
 directory.
 
\end_layout

\begin_layout Enumerate
Set 
\series bold
File name
\series default
 to: 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filejarfont}
\end_layout

\end_inset


\end_layout

\begin_layout Enumerate
Click 
\series bold
Save
\series default
.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
OK
\series default
 to confirm the success message.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
OK
\series default
 to close the 
\series bold
Options
\series default
 dialog.
 
\end_layout

\begin_layout Standard
The font is now ready to be used in a report.
\end_layout

\begin_layout Subsection
Embedding -- iReport
\end_layout

\begin_layout Standard
For 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appireport{}
\end_layout

\end_inset

 to find the 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filejarfont}
\end_layout

\end_inset

 file, the Java Virtual Machine must be told where the file is located.
 This is done by changing 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appireport{}
\end_layout

\end_inset

's Classpath settings.
 In 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appireport{}
\end_layout

\end_inset

, perform the following:
\end_layout

\begin_layout Enumerate
Click 
\series bold
Tools 
\begin_inset Quotes ald
\end_inset

 Options
\series default
.
 
\end_layout

\begin_layout Enumerate
Click the 
\series bold
Classpath 
\series default
tab.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Add JAR
\series default
.
 
\end_layout

\begin_layout Enumerate
Select 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filejarfont}
\end_layout

\end_inset

.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Open
\series default
.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
OK
\series default
 to close the 
\series bold
Options
\series default
 dialog.
 
\end_layout

\begin_layout Standard
Now that 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appireport{}
\end_layout

\end_inset

 has been configured to find the Java Archive file containing the font,
 you can assign the font.
 Rather than assigning the font directly, however, use a style from the
 style template as follows:
\end_layout

\begin_layout Enumerate
Open 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filejrtxpdf}
\end_layout

\end_inset

.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Window 
\begin_inset Quotes ald
\end_inset

 Template Inspector
\series default
 to display the 
\series bold
Template Inspector
\series default
 panel.
 
\end_layout

\begin_layout Enumerate
Right-click 
\series bold
Styles
\series default
 in the 
\series bold
Template Inspector
\series default
.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Add 
\begin_inset Quotes ald
\end_inset

 Style
\series default
.
 
\end_layout

\begin_layout Enumerate
Rename 
\series bold
Style_1
\series default
 to 
\series bold
ReportTitle
\series default
.
 
\end_layout

\begin_layout Enumerate
Change 
\series bold
Font name
\series default
 to 
\series bold
Liberation Serif
\series default
.
 
\end_layout

\begin_layout Enumerate
Save the file.
 
\end_layout

\begin_layout Enumerate
Click the 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filejrxmlcity}
\end_layout

\end_inset

 tab.
 
\end_layout

\begin_layout Enumerate
Click the 
\series bold
Report Title
\series default
 (Canadian Cities).
 
\end_layout

\begin_layout Enumerate
Set the 
\series bold
Style
\series default
 property to 
\series bold
ReportTitle
\series default
.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Preview
\series default
.
 
\end_layout

\begin_layout Standard
Even though the 
\series bold
Report Title
\series default
 Text properties appears as 
\series bold
SansSerif 
\series default
(meaning ``without serifs''), the font that is actually used is the Liberation
 Serif font.
 Serifs are the embellishments to the basic character shape, such as those
 emphasized in 
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:Serif-Font-Embellishments"

\end_inset

.
\end_layout

\begin_layout Standard
\begin_inset Float figure
wide false
sideways false
status collapsed

\begin_layout Plain Layout
\begin_inset Graphics
	filename drawings/serifs.png
	display false

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Caption

\begin_layout Plain Layout
\begin_inset CommandInset label
LatexCommand label
name "fig:Serif-Font-Embellishments"

\end_inset

Serif Font Embellishments
\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\begin_layout Subsection
Missing Glyphs
\end_layout

\begin_layout Standard
The problem described in 
\begin_inset CommandInset ref
LatexCommand ref
reference "sub:Style-Editing"

\end_inset

 can be seen by applying the same font to the column values for city names,
 as follows: 
\end_layout

\begin_layout Enumerate
Click the 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filejrtxpdf}
\end_layout

\end_inset

 tab.
 
\end_layout

\begin_layout Enumerate
Create a new 
\series bold
Style
\series default
 named 
\series bold
ColumnValue
\series default
.
 
\end_layout

\begin_layout Enumerate
Set the 
\series bold
Font name
\series default
 to 
\series bold
Liberation Serif
\series default
.
 
\end_layout

\begin_layout Enumerate
Save the file.
\end_layout

\begin_layout Enumerate
Click the 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filejrxmlcity}
\end_layout

\end_inset

 tab.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
$F{name}
\series default
.
 
\end_layout

\begin_layout Enumerate
Change the 
\series bold
Style
\series default
 to 
\series bold
ColumnValue
\series default
.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Preview
\series default
 to see the report (
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:Missing-Character"

\end_inset

).
\end_layout

\begin_deeper
\begin_layout Standard
\begin_inset Float figure
wide false
sideways false
status collapsed

\begin_layout Plain Layout
\begin_inset Graphics
	filename captures/abord-a-plouffe.png
	display false

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Caption

\begin_layout Plain Layout
\begin_inset CommandInset label
LatexCommand label
name "fig:Missing-Character"

\end_inset

Report - Missing Character
\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\end_deeper
\begin_layout Standard
The French city named Abord รข Plouffe is missing a-circumflex, because the
 minimized Liberation Serif font was over-zealously reduced.
 If you are using a font that has not been edited and this problem appears,
 it is likely that the author of the font did not include accented glyphs,
 which can be verified using FontForge.
\end_layout

\begin_layout Standard
Be careful when editing fonts.
 Do not remove glyphs that will be included in the report.
 To fix this issue, edit the font but do not remove the accented glyphs.
 This will increase the file size, but it will still be far smaller than
 the original TrueType Font.
 Remember to keep a local back-up copy, so that you can quickly revert your
 changes if you remove too many glyphs from the file.
\begin_inset Foot
status collapsed

\begin_layout Plain Layout
For fonts, the World Wide Web can be considered a back-up, but what happens
 when the web site goes offline, your Internet connection fails, or the
 font is pulled from the website for other reasons? Keep a pristine local
 copy, just in case.
\end_layout

\end_inset


\end_layout

\begin_layout Subsection
Embedding -- JasperReports
\end_layout

\begin_layout Standard
Since Java 1.4.2, the Java Virtual Machine has had a command-line option to
 configure optional packages.
\begin_inset Foot
status collapsed

\begin_layout Plain Layout
Not all versions of Java and not all Java Virtual Machines support the 
\family typewriter
-Djava.ext.dirs
\family default
 option.
\end_layout

\end_inset

 Effectively, this is a way of telling Java what directory names to scan
 for Java Archive files.
 For full details on the extension mechanism, read the official specification.
\begin_inset Foot
status collapsed

\begin_layout Plain Layout
\begin_inset CommandInset href
LatexCommand href
target "http://download.oracle.com/javase/1.4.2/docs/guide/extensions/spec.html"

\end_inset


\end_layout

\end_inset


\end_layout

\begin_layout Standard
Methods for adding libraries include the following:
\end_layout

\begin_layout Itemize

\series bold
Environment.

\series default
 Update the CLASSPATH environment variable.
 This may inadvertently cause conflicts when running multiple Java Virtual
 Machines and is not a recommended practice.
 
\end_layout

\begin_layout Itemize

\series bold
Existing.

\series default
 Copy the libraries into a directory already probed for Java libraries.
 This is a quick solution, but it is harder to maintain and may cause conflicts
 and confusion.
 Applications such as Ivy and Maven can help eliminate package conflicts.
\end_layout

\begin_layout Itemize

\series bold
Script.

\series default
 Update the application launcher script to include the library file(s) in
 the classpath.
 As a first step, this is the right direction, although it is ultimately
 a poor choice because adding new library files requires editing the launcher
 script.
 
\end_layout

\begin_layout Itemize

\series bold
Directory.

\series default
 Update the application launcher script to include a new library directory
 and then copy the files there.
 This is a low-maintenance solution, which requires a single edit and takes
 little effort to include new Java archives.
 
\end_layout

\begin_layout Standard
Using a directory specifically for holding library files is the optimal
 solution.
 If you want to apply the directory technique to the 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appphpjavabridge{}
\end_layout

\end_inset

, do the following:
\end_layout

\begin_layout Enumerate
Create the following directory: 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
windirprogbridgelib
\end_layout

\end_inset

.
\end_layout

\begin_layout Enumerate
Copy the following library files into 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
windirprogbridgelib
\end_layout

\end_inset

:
\end_layout

\begin_deeper
\begin_layout Itemize
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filejarfont}
\end_layout

\end_inset

 (created in 
\begin_inset CommandInset ref
LatexCommand vref
reference "sub:Archiving"

\end_inset

)
\end_layout

\begin_layout Itemize
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filejarlanguage}
\end_layout

\end_inset

 (created in 
\begin_inset CommandInset ref
LatexCommand vref
reference "sub:JasperReports"

\end_inset

)
\end_layout

\end_deeper
\begin_layout Standard
Modify the start-up file to run Java with the 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
windirprogbridge{}
\end_layout

\end_inset

 directory.
 For both Unix and Windows, note that 
\family typewriter
IREPORT_HOME
\family default
 references 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appireport{}
\end_layout

\end_inset

's installation directory.
 Apply the changes as follows (pick the operating system that applies):
\end_layout

\begin_layout Itemize
A batch file written for Windows (note the semi-colons) might include 
\begin_inset CommandInset ref
LatexCommand ref
reference "alg:Start-Bridge-Windows-Snippet"

\end_inset

.
\end_layout

\begin_deeper
\begin_layout Minisec
\begin_inset Float algorithm
wide false
sideways false
status collapsed

\begin_layout Plain Layout
\begin_inset Graphics
	filename source/scripts/bridge-start-win.bat.png
	display false

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Caption

\begin_layout Plain Layout
\begin_inset CommandInset label
LatexCommand label
name "alg:Start-Bridge-Windows-Snippet"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appphpjavabridge{}
\end_layout

\end_inset

 Windows Start-up Script Snippet
\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\end_deeper
\begin_layout Itemize
A Unix shell script might include text from 
\begin_inset CommandInset ref
LatexCommand ref
reference "alg:Start-Bridge-Unix-Snippet"

\end_inset

.
\end_layout

\begin_deeper
\begin_layout Standard
\begin_inset Float algorithm
wide false
sideways false
status collapsed

\begin_layout Plain Layout
\begin_inset Graphics
	filename source/scripts/bridge-start-unix.sh.png
	display false

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Caption

\begin_layout Plain Layout
\begin_inset CommandInset label
LatexCommand label
name "alg:Start-Bridge-Unix-Snippet"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appphpjavabridge{}
\end_layout

\end_inset

 Unix Start-up Script Snippet
\end_layout

\end_inset


\end_layout

\begin_layout Plain Layout

\end_layout

\end_inset


\end_layout

\end_deeper
\begin_layout Standard
If your application uses the classes from the Java Runtime Environment's
 library extension directory, you must also include that directory in the
 list.
 For example, in Unix, the shell script might include the text from 
\begin_inset CommandInset ref
LatexCommand ref
reference "alg:Bridge-Java-Extension-Directory"

\end_inset

.
\end_layout

\begin_layout Standard
\begin_inset Float algorithm
wide false
sideways false
status collapsed

\begin_layout Plain Layout
\begin_inset Graphics
	filename source/scripts/bridge-start-extdir.sh.png
	display false

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Caption

\begin_layout Plain Layout
\begin_inset CommandInset label
LatexCommand label
name "alg:Bridge-Java-Extension-Directory"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appphpjavabridge{}
\end_layout

\end_inset

 Extension Directory
\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\begin_layout Standard
The key portion of the Windows script:
\end_layout

\begin_layout LyX-Code

\family typewriter
%~dp0
\end_layout

\begin_layout Standard
The above line will be expanded to the fully qualified path that contains
 the batch file.
\end_layout

\begin_layout Standard
The equivalent key portion of the Unix script:
\end_layout

\begin_layout LyX-Code

\family typewriter
SCRIPT_HOME=$(dirname $(readlink -f ${BASH_SOURCE[0]}))
\end_layout

\begin_layout Standard
The above line determines the fully qualified path that contains the script,
 even when invoked over the 
\family typewriter
source
\family default
 command.
\begin_inset Foot
status collapsed

\begin_layout Plain Layout
At a shell prompt, type 
\family typewriter
help source
\family default
.
\end_layout

\end_inset


\end_layout

\begin_layout Section
Images
\end_layout

\begin_layout Standard
This section describes a method for converting a set of large, irregular
 images into a set of normalized images.
 Batch image manipulation is a useful technique to learn as it has many
 different applications.
 With JasperReports, na
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
"{i}
\end_layout

\end_inset

vely inserting unprocessed images will result in unappealing results, such
 as pixelation due to scaling.
 Processing the images before including them on the reports will produce
 the highest-quality results.
\end_layout

\begin_layout Standard
See 
\begin_inset CommandInset ref
LatexCommand vref
reference "sub:\\fileshellimages"

\end_inset

 for details on a shell script that can perform the task of conversion and
 normalization.
\end_layout

\begin_layout Subsection
Formats
\end_layout

\begin_layout Standard
As a general rule, use the following file formats:
\end_layout

\begin_layout Itemize
PNG for all images (logos, screen captures, clip-art, etc.), except photographs.
\end_layout

\begin_layout Itemize
JPEG for photographs, and only photographs.
\end_layout

\begin_layout Standard
To ensure the highest possibly quality of results, request and use original
 PNG files (EPS and TIFF are viable alternatives).
 Vector file formats that describe images in terms of drawing primitives
 (rather than individual pixels), such as Scalable Vector Graphics (SVG),
 will also help produce high-quality reports.
 You will encounter no problems using PNG files; whereas, you may encounter
 colour conversion issues with SVG and TIFF formats.
\end_layout

\begin_layout Subsection
Conversion
\end_layout

\begin_layout Standard
Conversion is the act of changing the data format of an image from one type
 to another.
 Searching the web for tools to batch convert PNG images will return a large
 number of results.
 Most of the results are great for batch conversion of JPG images, but will
 not produce satisfying results for logos and other types of line art or
 clip art, as the objective is to normalize a variety of logos in many different
 sizes and colours.
 The 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appireport{}
\end_layout

\end_inset

 product allows users to define a rectangular area for images.
 Even though 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appireport{}
\end_layout

\end_inset

 will do a statisfactory job at scaling images (up or down) to fit the defined
 area, there are a few issues that prevent the highest possible quality
 of results:
\end_layout

\begin_layout Itemize

\series bold
Border.

\series default
 Many corporate logos contain a fair amount of whitespace to make a distinct
 border.
 The border should be removed before scaling and resizing the image.
\end_layout

\begin_layout Itemize

\series bold
Format.

\series default
 Making changes to any image in a lossy format (such as JPEG) will degrade
 the results.
\end_layout

\begin_layout Standard
To resize images to fit on reports with high-quality results, do the following:
\end_layout

\begin_layout Enumerate
Acquire the images:
\end_layout

\begin_deeper
\begin_layout Enumerate
in a large (at least 8.5
\begin_inset Quotes erd
\end_inset

 wide), high-resolution (300dpi), lossless format (PNG); or
\end_layout

\begin_layout Enumerate
in a vector format, such as SVG.
\end_layout

\end_deeper
\begin_layout Enumerate
Remove the border from all the images using a process known as trimming.
\end_layout

\begin_layout Enumerate
Images larger than the report's image area must be scaled down to fit.
\end_layout

\begin_layout Enumerate
Images that have a width or height smaller than the report's image area
 must be padded with whitespace to fit.
\end_layout

\begin_layout Standard
You can automate the last three steps using batch image processing software.
 For most kinds of batch image processing, use ImageMagick.
\begin_inset Foot
status collapsed

\begin_layout Plain Layout
\begin_inset CommandInset href
LatexCommand href
target "http://www.imagemagick.org"

\end_inset


\end_layout

\end_inset


\end_layout

\begin_layout Subsection
Normalization
\end_layout

\begin_layout Standard
Normalization is the act of making all the images the same size and resolution.
 This can be done with content management systems, however not all content
 management systems produce the highest quality normalization.
 To normalize a set of images automatically requires the following steps
 for each image:
\end_layout

\begin_layout Enumerate
Cropping surrounding space (typically white or transparent space) 
\end_layout

\begin_layout Enumerate
Scaling (reducing, never expanding, the image size) 
\end_layout

\begin_layout Enumerate
Padding (adding white space for images that are too small) 
\end_layout

\begin_layout Standard
This can be accomplished with a simple shell script that uses ImageMagick.
\end_layout

\begin_layout Subsection
Lossless Optimization
\end_layout

\begin_layout Standard
Lossless optimization removes extraneous information from images to make
 the sizes smaller without degrading image quality.
\begin_inset Foot
status collapsed

\begin_layout Plain Layout
Try OptiPNG.
 
\begin_inset CommandInset href
LatexCommand href
target "http://optipng.sourceforge.net"

\end_inset


\end_layout

\end_inset

 Reducing image sizes carries with it the advantages described at the end
 of 
\begin_inset CommandInset ref
LatexCommand vref
reference "sub:Style-Editing"

\end_inset

.
\end_layout

\begin_layout Section
Standards
\end_layout

\begin_layout Standard
Create a report development standards document that describes different
 aspects of the reports.
 The standards document is easy to apply when using style templates.
 As a starting point, the standards document can include:
\end_layout

\begin_layout Itemize

\series bold
Colours.

\series default
 Provide a reference for corporate colours.
 Define a set of grayscale shades.
 Any colours or shades that are not listed are not to be used in reports.
 Take contrast and colourblindness into account.
 
\end_layout

\begin_layout Itemize

\series bold
Font styles.

\series default
 List the names of fonts that are suitable for reports.
 
\end_layout

\begin_layout Itemize

\series bold
Font sizes.

\series default
 Indicate the size of different text styles.
 Report titles, subtitles, column headers, footer text, and other major
 report labels should have a consistent size defined and applied.
 
\end_layout

\begin_layout Itemize

\series bold
Date and time.

\series default
 Determine how dates and times are to be formatted (such as date field order,
 internationalization, and time field formats).
\end_layout

\begin_layout Itemize

\series bold
Currency.

\series default
 What is the default currency for reports? What other currencies are anticipated
, and how are they to be formatted? 
\end_layout

\begin_layout Itemize

\series bold
Images.

\series default
 What are the maximum dimensions of an image, and what resolution (for example,
 300 dots per inch)? 
\end_layout

\begin_layout Standard
A report development standards document sets the stage for style templates.
\end_layout

\begin_layout Section
Layers
\end_layout

\begin_layout Standard
Layers were added to 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appireport{}
\end_layout

\end_inset

 3.7.2 to reduce duplication of 
\series bold
PrintWhenExpression
\series default
 statements.
 To view an example of how layers work, do the following:
\end_layout

\begin_layout Enumerate
Open 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filejrxmlcity}
\end_layout

\end_inset

.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Window 
\begin_inset Quotes ald
\end_inset

 Layers
\series default
.
 
\end_layout

\begin_layout Enumerate
Click the 
\series bold
New layer
\series default
 icon.
 
\end_layout

\begin_layout Enumerate
Rename 
\series bold
Layer 1
\series default
 to 
\series bold
FilterRegion
\series default
.
 
\end_layout

\begin_layout Enumerate
Select the 
\series bold
Detail 1
\series default
 band fields (for example, 
\series bold
$F{id}
\series default
 through to 
\series bold
$F{longitude}
\series default
) shown in 
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:Detail-Band-Field-Selection"

\end_inset

.
\end_layout

\begin_deeper
\begin_layout Standard
\begin_inset Float figure
wide false
sideways false
status collapsed

\begin_layout Plain Layout
\begin_inset Graphics
	filename captures/ireport-layers-selection.png

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Caption

\begin_layout Plain Layout
\begin_inset CommandInset label
LatexCommand label
name "fig:Detail-Band-Field-Selection"

\end_inset

Detail Band Field Selection
\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\end_deeper
\begin_layout Enumerate
Right-click any selected field.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Send to layer 
\begin_inset Quotes ald
\end_inset

 FilterRegion
\series default
.
 
\end_layout

\begin_layout Enumerate
Right-click 
\series bold
FilterRegion
\series default
.
 
\end_layout

\begin_layout Enumerate
Click 
\series bold
Print
\series default
 
\series bold
When Expression
\series default
 to display the 
\series bold
Expression editor
\series default
 dialog.
 
\end_layout

\begin_layout Enumerate
Set the expression to: 
\end_layout

\begin_deeper
\begin_layout LyX-Code

\family typewriter
$F{region_id} != 10
\end_layout

\end_deeper
\begin_layout Enumerate
Click 
\series bold
Apply
\series default
.
\end_layout

\begin_layout Enumerate
Click 
\series bold
Preview
\series default
.
\end_layout

\begin_layout Standard
Only rows with the region identifier not equal to ten are displayed.
 To eliminate the gap left behind by the filtered row:
\end_layout

\begin_layout Enumerate
Right-click 
\series bold
FilterRegion
\series default
.
\end_layout

\begin_layout Enumerate
Click 
\series bold
Select Elements
\series default
.
\end_layout

\begin_layout Enumerate
Check 
\series bold
Remove Line When Blank
\series default
 in the 
\series bold
Properties
\series default
 panel.
\end_layout

\begin_layout Enumerate
Click 
\series bold
Preview
\series default
.
\end_layout

\begin_layout Standard
The purpose of this example is to demonstrate that when multiple fields
 have the same 
\series bold
PrintWhenExpression
\series default
 statement, those fields should be assigned to the same layer.
 The layer, then, is the only place where the expression statement is specified.
\end_layout

\begin_layout Section
Formatting Tools
\end_layout

\begin_layout Standard
Avoiding work, that is, becoming an expedient report developer, entails
 becoming familiar with the tool.
 Take some time to learn the different panels, options, and icons.
 Often, there are faster ways to perform tasks, much inefficient manual
 labour can be avoided.
\end_layout

\begin_layout Standard
For example, if all you want to know is whether the report still compiles,
 one way is to click 
\series bold
Preview
\series default
.
 A faster way (because it means not having to run the report and close it)
 is to click the 
\series bold
Compile Report
\series default
 icon, not far from the 
\series bold
Preview
\series default
 button.
\end_layout

\begin_layout Standard
The 
\series bold
Formatting Tools Window
\series default
 panel (click 
\series bold
Window 
\begin_inset Quotes ald
\end_inset

 Formatting Tools
\series default
) provides a wide variety of alignment tools that can greatly reduce the
 amount of time invested into arranging and aligning fields perfectly.
 Click a single field on the report to enable the features in 
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:iReport-Formatting-Tools"

\end_inset

.
\end_layout

\begin_layout Standard
\begin_inset Float figure
wide false
sideways false
status collapsed

\begin_layout Plain Layout
\begin_inset Graphics
	filename captures/ireport-formatting-tools.png

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Caption

\begin_layout Plain Layout
\begin_inset CommandInset label
LatexCommand label
name "fig:iReport-Formatting-Tools"

\end_inset

Formatting Tools Window Panel
\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\begin_layout Standard
Selecting multiple report elements enables features to align selected objects
 relative to each other.
\end_layout

\begin_layout Section
Summary
\end_layout

\begin_layout Standard
Great programmers are hard-working lazy people.
 This is not a contradiction.
 Lazy programmers make life simple for themselves by reducing the amount
 of work they might have to do in the future.
 Lazy programmers avoid monotonous, repetitive tasks.
 Instead, they learn regular expressions so that they can perform complex
 text replacements in a few keystrokes---instead, they discover features
 in software that allow them to take short-cuts.
\end_layout

\begin_layout Standard
Using 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appireport{}
\end_layout

\end_inset

 is like using any other software tool: great programmers find ways to avoid
 repeating work.
 This is one secret to their speed.
 Creating style templates falls in line with this type of thinking.
 Rather than manually setting the same font family, font size, field padding,
 colours, and text borders across all report fields for all reports, the
 appearance is coded once (in a style template) and then applied by setting
 a pre-defined style to all relevant fields.
\end_layout

\begin_layout Standard
Expedient developers also make extensive use the keyboard.
 Rather than click a button to cancel changes, they press the escape key
 as it is faster.
 Developers are also familiar with using the mouse to highlight ranges of
 items (for example, clicking the first item in the range, holding down
 the shift key, clicking the last item, and then using control-shift-click
 to select an additional range).
 Spending five minutes to apply a style template to dozens of report columns,
 one at a time, is a waste of time when all the desired columns can be selected
 in a few seconds.
\end_layout

\end_body
\end_document