What is meaning of exportFonts in config JasperReport font? - jasper-reports

I mimic configuration embed fonts for JasperReport (version 6.20.0)
<?xml version="1.0" encoding="UTF-8"?>
<fontFamilies>
<fontFamily name="Arial">
<normal><![CDATA[fonts/Arial/ARIAL.ttf]]></normal>
<bold><![CDATA[fonts/Arial/ARIALB.ttf]]></bold>
<italic><![CDATA[fonts/Arial/ARIALI.ttf]]></italic>
<boldItalic><![CDATA[fonts/Arial/ARIALBD.ttf]]></boldItalic>
<pdfEncoding><![CDATA[Identity-H]]></pdfEncoding>
<pdfEmbedded><![CDATA[true]]></pdfEmbedded>
<exportFonts/>
</fontFamily>
<fontFamily name="TimesNewRoman">
<normal><![CDATA[fonts/TimesNewRoman/TIMES.ttf]]></normal>
<bold><![CDATA[fonts/TimesNewRoman/TIMESB.ttf]]></bold>
<italic><![CDATA[fonts/TimesNewRoman/TIMESI.ttf]]></italic>
<boldItalic><![CDATA[fonts/TimesNewRoman/TIMESBI.ttf]]></boldItalic>
<pdfEncoding><![CDATA[Identity-H]]></pdfEncoding>
<pdfEmbedded><![CDATA[true]]></pdfEmbedded>
<exportFonts/>
</fontFamily>
<fontFamily name="DejaVu Serif">
<normal>net/sf/jasperreports/fonts/dejavu/DejaVuSerif.ttf</normal>
<bold>net/sf/jasperreports/fonts/dejavu/DejaVuSerif-Bold.ttf</bold>
<italic>net/sf/jasperreports/fonts/dejavu/DejaVuSerif-Italic.ttf</italic>
<boldItalic>net/sf/jasperreports/fonts/dejavu/DejaVuSerif-BoldItalic.ttf</boldItalic>
<pdfEncoding>Identity-H</pdfEncoding>
<pdfEmbedded>true</pdfEmbedded>
<exportFonts>
<export key="net.sf.jasperreports.html">'DejaVu Serif', 'Times New Roman', Times, serif</export>
</exportFonts>
</fontFamily>
</fontFamilies>
What is meaning and benefit of this code snippet
<exportFonts>
<export key="net.sf.jasperreports.html">'DejaVu Serif', 'Times New Roman', Times, serif</export>
</exportFonts>

It specifies the replacement fonts to use if the font-family is not available on the target environment.
Description from TICO JasperSoft Studio during font-extension creation
To understand this, you should know that font-extension was primarily added to export to pdf, embed the desired fonts in the pdf.
However jasper report can export to many different formats and in your case:
<export key="net.sf.jasperreports.html">'DejaVu Serif', 'Times New Roman', Times, serif</export>
or
<export key="html">'DejaVu Serif', 'Times New Roman', Times, serif</export>
Is stating that when exporting to html (and only html) it should generate css similar to
body {
font-family: 'DejaVu Serif', 'Times New Roman', Times, serif;
}
Which indicate sequenze of font to use if one is not available on user platform (search for css font-family attribute to learn more).
The only use for this tag that I know of is if you wish to export to html or rtf and for html only add if you like the substitution, if instead you like to use custom font do not added it, jasper report will generate css to include the font (font-face tag). See my "old" answer for more information about font-extension limitations.

Related

What causes Eclipse to not show FXML file errors until compilation?

After installing e(FX)clipse (an eclipse plugin that deals with JavaFX files) the editor works the same way for all files not relating to JavaFX, as to be expected. However, FXML files (which the plugin should help with creation, reading, and editing) do not show errors from eclipse. While it will run properly if all code is correct, it becomes very tedious very fast having to carefully import each class by hand.
After looking through several threads I've found similar problems crop up, with varied solutions.
I have:
1.Used Project> Clean... several times
2.Removed and replaced the project build path
3.Gone through all validation settings for both Java and XML files
4.Checked Problems panel filters to ensure they weren't being hidden in XML files.
5.Checked for missing JavaFX user library.
6.Checked for Project> Build Automatically turned off.
7.Turned Project> Build Automatically on and off.
Say I have this code:
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.layout.ColumnConstraints?>
<GridPane xmlns:fx="http:javafx.com/fxml" alignment="center"
Hgap="10" Vgap="10">
<Button text="Button One" GridPane.rowIndex="0"
GridPane.columnIndex="0"></Button>
<Button text="Button Two" GridPane.rowIndex="0"
GridPane.columnIndex="1"></Button>
<Button text="Button Three" GridPane.rowIndex="1"
GridPane.columnIndex="0"></Button>
<Button text="Really extra long button Four" GridPane.rowIndex="3"
GridPane.columnIndex="0" GridPane.columnSpan="2"></Button>
<Button text="Button Five" GridPane.rowIndex="1"
GridPane.columnIndex="1"></Button>
</GridPane>
This should be, and is, errorless.
But once I change it to this:
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets
<?import javafx.scene.ll.Label
<?import javafx.sceext.Font
<?import javafx.gnment="center"
Hgap="10" Vgap="10">
<Button text="Button One" GridPane.rowIndex="0"
GridPane.columnIndex="0"></Button>
<Button text="Button Two" GridPane.rowIndex="0"
GridPane.columnIndex="1"></Button>
<Button text="Button Three" GridPane.rowIndex=
<Button text="Really extra long button Four" GridPane.rowIndex="3"
GridPane.columnIndex="0" GridPane.columnSpan="2"></Button>
<Button text="Button Five" GridPane.rowIndex="1"
GridPane.columnIndex="1"></Button>
</GridPane>
Randomly mutilating it, it stays completely errorless until I attempt to run it. If I mess with the code in a more ordered way (to maximize potential errors) the result is the same.
No errors occur on the side of the code (preferred) or in the problems panel.

Typo3 7.6 Flux backend layout column title

I created a basic template with the builder extension. In the page properties I set Backend layout to fuildpages and I see now in the backend the 2 columns that the builder extension created:
<f:section name="Configuration">
<flux:form id="standard">
<!-- Insert fields, sheets, grid, form section objects etc. here, in this flux:form tag -->
</flux:form>
<flux:grid>
<!-- Edit this grid to change the "backend layout" structure -->
<flux:grid.row>
<flux:grid.column colPos="0" colspan="3" name="main" />
<flux:grid.column colPos="1" name="right" />
</flux:grid.row>
</flux:grid>
</f:section>
<f:section name="Main">
<h1>I am a page template!</h1>
<p>
My template file is EXT:my_template/Resources/Private/Page/Standard.html.
</p>
<div style="float: left; width: 75%;">
<h2>Content main</h2>
<v:content.render column="0" />
</div>
<div style="float: left; width: 25%;">
<h2>Content right</h2>
<v:content.render column="1" />
</div>
</f:section>
But in the backend this columns don't have the names "main" and "right".
In typo3 6.2 this worked with the basic template the builder create. Do I miss something?
And an additional question: Is there a sysext for the default backend layout "Left" "Normal" "Right" "Border"? I wanted to watch there how it is done but I could not find it.
You need to set the label attribute on your <flux:grid.column/>-tags. The name attribute is only used to reference the column in other places, for example to render it using the <v:content.render/>-ViewHelper from EXT:vhs.
A note on translations of the column label: The label attribute can not contain usages of the <f:translate/>-ViewHelper, due to caching (GitHub issue). If you want to translate your column names, you need to provide the translation under some default key, which one that is is explained here.

Is it possible to set the column width of a grid in GWT using uibinder?

I'm trying to use the GWT grid component in uibinder. It works fine until I want to set the width of the columns. The following is what I've tried to do but it doesn't seem to work.
<g:Grid width="100%">
<g:row>
<g:customCell width="20%">
<g:FlowPanel width="">
</g:FlowPanel>
</g:customCell>
<g:customCell width="80%">
<g:FlowPanel width="">
</g:FlowPanel>
</g:customCell>
</g:row>
</g:Grid>
You can write some java code in order to do that, example:
grid.getColumnFormatter().setWidth(0, "10%");
grid.getColumnFormatter().setWidth(1, "10%");
Only styleName is taken into account on g:row, g:cell and g:customCell elements.
If you can (i.e. if your grid content is mostly static), avoid using Grid and prefer an HTMLPanel containing an HTML <table>, this gives you much more flexibility.
http://code.google.com/p/google-web-toolkit/source/browse/tags/2.4.0/user/src/com/google/gwt/uibinder/elementparsers/GridParser.java

Hiding parts of OpenXml documents programmatically

Is it possible to programmatically hide parts of an OpenXML document, without actually removing it?
The reason I would want to do this: This is a template file, dynamic parts are filled using databindig. And some parts should be hidden, if there is no backing data. But don't want to actually remove parts from the document, so the document could be "refreshed" later with new data.
Something like display: none in html/css.
The is no exact equivalent to hiding content in Word using the open xml sdk. However there are two approaches that might work for you:
Hidden paragraph trick
Create a style, let's call it HiddenParagraph. Define it in your styles.xml as follows:
<w:style w:type="paragraph" w:customStyle="1" w:styleId="HiddenParagraph">
<w:name w:val="HiddenParagraph" />
<w:next w:val="Normal" />
<w:pPr>
<w:spacing w:line="14" w:lineRule="auto" />
</w:pPr>
<w:rPr>
<w:rFonts w:asciiTheme="minorHAnsi" w:eastAsiaTheme="minorEastAsia" w:hAnsiTheme="minorHAnsi" w:cstheme="minorBidi" />
<w:sz w:val="22" />
<w:szCs w:val="22" />
</w:rPr>
</w:style>
The w:line=14 makes the paragraph effectively invisible.
Now render the content your don't want to see using this paragraph style.
<w:p>
<w:pPr>
<w:pStyle w:val="HiddenParagraph" />
</w:pPr>
<w:r>
<w:text>you should not be able to see me
</w:r>
</w:p>
To show the content again just change the paragraph style to normal or some other more sane style.
Custom XML Part
Store data you don't want to display in the document in a custom xml data store, although this might not work in your specific scenario
Reference
http://openxmldeveloper.org/blog/b/openxmldeveloper/archive/2010/10/27/59361.aspx

Unwanted Helvetica font is using in pdf by Jasper

I have a problem that Helvetica, which I am not using in any of my JRXML fields, is being used as the default font in Jasper PDF reports.
I am using iReports 4.0.2.
The first variant is to set the default font via setting net.sf.jasperreports.default.font.name and/or net.sf.jasperreports.default.pdf.font.name properties.
For example, it were my defaults settings in iReport (dialog Options -> JasperReports Properties):
With this settings (without setting default style in the template) I have the Helvetica font in my pdf generated by iReport.
After that I've changed settings in iReport like this:
And now I have Courier font in my pdf file (generated by iReport):
With JasperReports API you can set this properties with help of JRProperties.setProperty(java.lang.String key, boolean value) method.
The sample:
JRProperties.setProperty("net.sf.jasperreports.default.pdf.font.name", defaultPDFFont);
JasperReport jasperReport = JasperCompileManager.compileReport(reportSource);
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params);
JasperExportManager.exportReportToPdfFile(jasperPrint, outputFileName);
Another variant is to add default style in report's template.
The example:
<jasperReport .. topMargin="20" bottomMargin="20">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<style name="Base" isDefault="true" hAlign="Center" vAlign="Middle" fontSize="10" pdfFontName="Courier" pdfEncoding="UTF8" isPdfEmbedded="false"/>
<queryString>
More information about working with fonts you can read here.
I use NetBeans and on one of my projects i wanted to use Garamond as my default font for my pdfs so what i did was:
Tools -> options
Under IReport, click the Fonts Tab
Install a Font
Click on the "Export as Extension Button" which exports it as a jar file.
Add to class path.
Run report, save it, then view it.