IDML Filter: yield font mapping capabilities
The font mapping can be considered as a filter ability to automatically substitute font information in the target file on the fly, according to a provided configuration.
The following font mapping configuration options have to be present:
- The target language:
en
,en-UK
, etc. It can be left empty to apply the mapping to any target language. - The source font name regular expression pattern:
Arial.*
,Times New Roman
, etc. It can be left empty to apply the mapping to any source font name found. - The target font name:
Arial
,Times New Roman
, etc. It should not be empty. And if it is made so, the mapping configuration can be ignored.
The attached IDML file can be used for initial experiments.
Comments (6)
-
reporter -
Sample of the parameters serialization in the PR:
fontMappings.number.i=3 fontMappings.0.values=:Times.*:Arial Unicode MS fontMappings.1.values=en:The Sims Sans:Arial Unicode MS fontMappings.2.values=en:Arial Unicode MS:Times New Roman
-
reporter This is how the values can be specified (a JavaDoc from the
net.sf.okapi.common.filters.ParametersStringFontMapping#fromParametersString
method):The following values format is supported (the default delimiter is
specified at the moment):
[Target language]DELIMITER[Source font name pattern]DELIMITER[Target font name pattern]The target language should be set to the value for which the mapping is
applied (with {@link net.sf.okapi.common.LocaleId} compatible). E.g.:
en, en-UK. Also, it can be left empty and in this case the mapping will
be applied to any available target language.The source font name pattern can be any supported regular expression.
When it is left empty, the mapping is applied to any available source
font.The target font name can be a particular font name or can be left empty.
In the latter case the mapping will not be applied (ignored).The delimiter value can be any supported regular expression.
Also, the font mappings are applied in the order they are stated in parameters and it is possible to end up with the very same font if you follow this configuration example below:
fontMappings.number.i=2 fontMappings.0.values=en:Times New Roman:Arial Unicode MS fontMappings.1.values=en:Arial Unicode MS:Times New Roman
-
reporter - edited description
-
reporter The parameters serialisation format is looking like that now:
fontMappings.0.sourceLocalePattern=en.* fontMappings.0.targetLocalePattern=ru.* fontMappings.0.sourceFontPattern=Times.* fontMappings.0.targetFont=Arial Unicode MS fontMappings.1.sourceLocalePattern=ru fontMappings.1.targetLocalePattern=fr fontMappings.1.sourceFontPattern=The Sims Sans fontMappings.1.targetFont=Arial Unicode MS fontMappings.number.i=2"
-
reporter - changed status to resolved
The pull request #396 has been merged.
- Log in to comment
A related pull request #396 has been opened.