-
Notifications
You must be signed in to change notification settings - Fork 603
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add flag to inhibit FOP glyph substitution (#904)
* add flag to inhibit FOP glyph substitution * add Javadoc parameter description * make text rendering options object mutable as requested at #904 (review) * transfer text rendering options to PdfDocument
- Loading branch information
Showing
6 changed files
with
144 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
openpdf/src/main/java/com/lowagie/text/TextRenderingOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package com.lowagie.text; | ||
|
||
import com.lowagie.text.pdf.FopGlyphProcessor; | ||
|
||
/** | ||
* Text rendering options, including the default language of the document and a flag | ||
* to enable font glyph substitution (if FOP is available). | ||
* | ||
* @author Lucian Chirita (lucianc@users.sourceforge.net) | ||
* @see Document#setTextRenderingOptions(TextRenderingOptions) | ||
* @since 3.1.15 | ||
*/ | ||
public class TextRenderingOptions { | ||
|
||
public static final String DOCUMENT_LANGUAGE_DEFAULT = "dflt"; | ||
|
||
/** | ||
* The default language of the document. Can be set to values like "en_US". | ||
* This language is used in {@link FopGlyphProcessor} to determine which glyphs are to be substituted. | ||
* The default "dflt" means that all glyphs which can be replaced will be substituted. | ||
* | ||
*/ | ||
private String documentLanguage; | ||
|
||
private boolean glyphSubstitutionEnabled; | ||
|
||
/** | ||
* Creates a text rendering options instance with the default options: glyph substitution enabled | ||
* and "dflt" as document language. | ||
*/ | ||
public TextRenderingOptions() { | ||
this(DOCUMENT_LANGUAGE_DEFAULT, true); | ||
} | ||
|
||
/** | ||
* Creates a text rendering options instance. | ||
* | ||
* @param documentLanguage the wanted language | ||
* @param glyphSubstitutionEnabled whether glyph substitution is enabled | ||
*/ | ||
public TextRenderingOptions(String documentLanguage, boolean glyphSubstitutionEnabled) { | ||
this.documentLanguage = documentLanguage; | ||
this.glyphSubstitutionEnabled = glyphSubstitutionEnabled; | ||
} | ||
|
||
/** | ||
* Sets the default language of the document. | ||
* | ||
* @param documentLanguage the document language | ||
* @see #getDocumentLanguage() | ||
*/ | ||
public void setDocumentLanguage(String documentLanguage) { | ||
this.documentLanguage = documentLanguage; | ||
} | ||
|
||
/** | ||
* The default language of the document. Can be set to values like "en_US". This language is used in | ||
* FopGlyphProcessor to determine which glyphs are to be substituted. | ||
* <P/> | ||
* The default "dflt" means that all glyphs which can be replaced will be substituted. | ||
* | ||
* @return the current document language | ||
*/ | ||
public String getDocumentLanguage() { | ||
return documentLanguage; | ||
} | ||
|
||
/** | ||
* Sets the font glyph substitution enabled flag. | ||
* | ||
* @param glyphSubstitutionEnabled whether glyph substitution is enabled | ||
*/ | ||
public void setGlyphSubstitutionEnabled(boolean glyphSubstitutionEnabled) { | ||
this.glyphSubstitutionEnabled = glyphSubstitutionEnabled; | ||
} | ||
|
||
/** | ||
* Returns the glyph substitution enabled flag. | ||
* | ||
* @return the glyph substitution enabled flag | ||
* #see {@link Document#setGlyphSubstitutionEnabled(boolean)} | ||
*/ | ||
public boolean isGlyphSubstitutionEnabled() { | ||
return glyphSubstitutionEnabled; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters