From 1c23dc94539ea82b14a1071228dc2a2e20c83d26 Mon Sep 17 00:00:00 2001 From: Bert Frees Date: Fri, 6 Mar 2015 12:50:15 +0100 Subject: [PATCH 01/15] liblouis-core: support text-transform property supported values are louis-bold, louis-ital, louis-under and louis-comp --- .../liblouis/impl/LiblouisJnaImpl.java | 39 +++++++++++++++++-- .../liblouis/impl/LiblouisJnaImplTest.java | 6 +++ 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/pipeline-braille-utils/liblouis/liblouis-core/src/main/java/org/daisy/pipeline/braille/liblouis/impl/LiblouisJnaImpl.java b/pipeline-braille-utils/liblouis/liblouis-core/src/main/java/org/daisy/pipeline/braille/liblouis/impl/LiblouisJnaImpl.java index 44cb5084e..5c1703878 100644 --- a/pipeline-braille-utils/liblouis/liblouis-core/src/main/java/org/daisy/pipeline/braille/liblouis/impl/LiblouisJnaImpl.java +++ b/pipeline-braille-utils/liblouis/liblouis-core/src/main/java/org/daisy/pipeline/braille/liblouis/impl/LiblouisJnaImpl.java @@ -299,6 +299,8 @@ public String[] transform(String[] text, String[] cssStyle) { for (int i = 0; i < cssStyle.length; i++) { Map style = CSS_PARSER.split(cssStyle[i]); typeform[i] = typeformFromInlineCSS(style); + if (style.containsKey("text-transform")) + typeform[i] |= typeformFromTextTransform(style.get("text-transform")); hyphenate[i] = false; if (style.containsKey("hyphens") && "auto".equals(style.get("hyphens"))) hyphenate[i] = true; } @@ -509,7 +511,7 @@ protected byte[] doHyphenate(String text) { = Splitter.on(';').omitEmptyStrings().withKeyValueSeparator(Splitter.on(':').limit(2).trimResults()); /** - * @parameter cssStyle An inline CSS style + * @parameter style An inline CSS style * @returns the corresponding typeform. Possible values are: * - 0 = PLAIN * - 1 = ITALIC (font-style: italic|oblique) @@ -527,16 +529,45 @@ protected static byte typeformFromInlineCSS(Map style) { for (String prop : style.keySet()) { String value = style.get(prop); if (prop.equals("font-style") && (value.equals("italic") || value.equals("oblique"))) - typeform += Typeform.ITALIC; + typeform |= Typeform.ITALIC; else if (prop.equals("font-weight") && value.equals("bold")) - typeform += Typeform.BOLD; + typeform |= Typeform.BOLD; else if (prop.equals("text-decoration") && value.equals("underline")) - typeform += Typeform.UNDERLINE; + typeform |= Typeform.UNDERLINE; else logger.warn("Inline CSS property {} not supported", prop); } return typeform; } + private final static Splitter TEXT_TRANSFORM_PARSER = Splitter.on(' ').omitEmptyStrings().trimResults(); + + /** + * @parameter textTransform A text-transform value as a space separated list of keywords. + * @returns the corresponding typeform. Possible values are: + * - 0 = PLAIN + * - 1 = ITALIC (louis-ital) + * - 2 = BOLD (louis-bold) + * - 4 = UNDERLINE (louis-under) + * - 8 = COMPUTER (louis-comp) + * These values can be added for multiple emphasis. + * @see http://liblouis.googlecode.com/svn/documentation/liblouis.html#lou_translateString + */ + protected static byte typeformFromTextTransform(String textTransform) { + byte typeform = Typeform.PLAIN; + for (String tt : TEXT_TRANSFORM_PARSER.split(textTransform)) { + if (tt.equals("louis-ital")) + typeform |= Typeform.ITALIC; + else if (tt.equals("louis-bold")) + typeform |= Typeform.BOLD; + else if (tt.equals("louis-under")) + typeform |= Typeform.UNDERLINE; + else if (tt.equals("louis-comp")) + typeform |= Typeform.COMPUTER; + else + logger.warn("text-transform: {} not supported", tt); } + return typeform; + } + private static final Logger logger = LoggerFactory.getLogger(LiblouisJnaImpl.class); } diff --git a/pipeline-braille-utils/liblouis/liblouis-core/src/test/java/org/daisy/pipeline/braille/liblouis/impl/LiblouisJnaImplTest.java b/pipeline-braille-utils/liblouis/liblouis-core/src/test/java/org/daisy/pipeline/braille/liblouis/impl/LiblouisJnaImplTest.java index c4f046c5f..9f18f16e5 100644 --- a/pipeline-braille-utils/liblouis/liblouis-core/src/test/java/org/daisy/pipeline/braille/liblouis/impl/LiblouisJnaImplTest.java +++ b/pipeline-braille-utils/liblouis/liblouis-core/src/test/java/org/daisy/pipeline/braille/liblouis/impl/LiblouisJnaImplTest.java @@ -13,4 +13,10 @@ public void testTypeformFromInlineCSS() { LiblouisJnaImpl.typeformFromInlineCSS( " text-decoration: underline ;font-weight: bold ; hyphens:auto; color: #FF00FF ")); } + + @Test + public void testTypeformFromTextTransform() { + assertEquals(Typeform.BOLD + Typeform.UNDERLINE, + LiblouisJnaImpl.typeformFromTextTransform(" louis-bold ital louis-under foo ")); + } } From 86a179242f6ee4fa4119ae071feb58270f18a7e1 Mon Sep 17 00:00:00 2001 From: Bert Frees Date: Fri, 6 Mar 2015 13:13:51 +0100 Subject: [PATCH 02/15] css-core: add text-transform property --- .../css/BrailleCSSDeclarationTransformer.java | 26 +++++++++++++++++++ .../daisy/braille/css/BrailleCSSProperty.java | 23 ++++++++++++++++ .../braille/css/SupportedBrailleCSS.java | 5 +++- .../src/main/resources/xml/braille-css.xsl | 5 ++++ 4 files changed, 58 insertions(+), 1 deletion(-) diff --git a/pipeline-braille-utils/css/css-core/src/main/java/org/daisy/braille/css/BrailleCSSDeclarationTransformer.java b/pipeline-braille-utils/css/css-core/src/main/java/org/daisy/braille/css/BrailleCSSDeclarationTransformer.java index 2a0beacb1..aac30ed7d 100644 --- a/pipeline-braille-utils/css/css-core/src/main/java/org/daisy/braille/css/BrailleCSSDeclarationTransformer.java +++ b/pipeline-braille-utils/css/css-core/src/main/java/org/daisy/braille/css/BrailleCSSDeclarationTransformer.java @@ -17,6 +17,7 @@ import org.daisy.braille.css.BrailleCSSProperty.Page; import org.daisy.braille.css.BrailleCSSProperty.StringSet; import org.daisy.braille.css.BrailleCSSProperty.TextIndent; +import org.daisy.braille.css.BrailleCSSProperty.TextTransform; import cz.vutbr.web.css.CSSFactory; import cz.vutbr.web.css.CSSProperty; @@ -281,6 +282,31 @@ private boolean processTextIndent(Declaration d, d, properties, values); } + @SuppressWarnings("unused") + private boolean processTextTransform(Declaration d, + Map properties, Map> values) { + + if (d.size() == 1 && genericOneIdent(TextTransform.class, d, properties)) + return true; + + TermList list = tf.createList(); + for (Term t : d.asList()) { + if (t instanceof TermIdent) { + String value = ((TermIdent)t).getValue().toLowerCase(); + if (!value.equals("auto")) + list.add(t); } + else + return false; + } + + if (list.isEmpty()) + return false; + + properties.put("text-transform", TextTransform.list_values); + values.put("text-transform", list); + return true; + } + /**************************************************************** * GENERIC METHODS ****************************************************************/ diff --git a/pipeline-braille-utils/css/css-core/src/main/java/org/daisy/braille/css/BrailleCSSProperty.java b/pipeline-braille-utils/css/css-core/src/main/java/org/daisy/braille/css/BrailleCSSProperty.java index 0f84bbe10..ec3eef23a 100644 --- a/pipeline-braille-utils/css/css-core/src/main/java/org/daisy/braille/css/BrailleCSSProperty.java +++ b/pipeline-braille-utils/css/css-core/src/main/java/org/daisy/braille/css/BrailleCSSProperty.java @@ -239,4 +239,27 @@ public String toString() { return text; } } + + public enum TextTransform implements BrailleCSSProperty { + list_values(""), AUTO("auto"), INHERIT("inherit"); + + private String text; + + private TextTransform(String text) { + this.text = text; + } + + public boolean inherited() { + return false; + } + + public boolean equalsInherit() { + return this == INHERIT; + } + + @Override + public String toString() { + return text; + } + } } diff --git a/pipeline-braille-utils/css/css-core/src/main/java/org/daisy/braille/css/SupportedBrailleCSS.java b/pipeline-braille-utils/css/css-core/src/main/java/org/daisy/braille/css/SupportedBrailleCSS.java index ecb8c0204..91cabd3e2 100644 --- a/pipeline-braille-utils/css/css-core/src/main/java/org/daisy/braille/css/SupportedBrailleCSS.java +++ b/pipeline-braille-utils/css/css-core/src/main/java/org/daisy/braille/css/SupportedBrailleCSS.java @@ -32,6 +32,7 @@ import org.daisy.braille.css.BrailleCSSProperty.Page; import org.daisy.braille.css.BrailleCSSProperty.StringSet; import org.daisy.braille.css.BrailleCSSProperty.TextIndent; +import org.daisy.braille.css.BrailleCSSProperty.TextTransform; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -43,7 +44,7 @@ public class SupportedBrailleCSS implements SupportedCSS { private static Logger log = LoggerFactory.getLogger(SupportedBrailleCSS.class); - private static final int TOTAL_SUPPORTED_DECLARATIONS = 35; + private static final int TOTAL_SUPPORTED_DECLARATIONS = 36; private static final TermFactory tf = CSSFactory.getTermFactory(); @@ -231,6 +232,8 @@ private void setSupportedCSS() { embossedProperties.add("string-set"); props.put("content", Content.NONE); embossedProperties.add("content"); + props.put("text-transform", TextTransform.AUTO); + embossedProperties.add("text-transform"); /* ----------- */ /* media print */ diff --git a/pipeline-braille-utils/css/css-core/src/main/resources/xml/braille-css.xsl b/pipeline-braille-utils/css/css-core/src/main/resources/xml/braille-css.xsl index 078e1f33d..db2f565cf 100644 --- a/pipeline-braille-utils/css/css-core/src/main/resources/xml/braille-css.xsl +++ b/pipeline-braille-utils/css/css-core/src/main/resources/xml/braille-css.xsl @@ -51,6 +51,7 @@ 'white-space', 'hyphens', 'size', + 'text-transform', 'font-style', 'font-weight', 'text-decoration', @@ -89,6 +90,7 @@ re:exact(re:or(('normal','pre-wrap','pre-line'))), re:exact(re:or(('auto','manual','none'))), re:exact(concat('(',$css:NON_NEGATIVE_INTEGER_RE,')\s+(',$css:NON_NEGATIVE_INTEGER_RE,')')), + re:exact(re:or(($css:IDENT_LIST_RE,'auto'))), re:exact(re:or(('normal','italic','oblique'))), re:exact(re:or(('normal','bold','100','200','300','400','500','600','700','800','900'))), re:exact(re:or(('none','underline','overline','line-through','blink'))), @@ -130,6 +132,7 @@ '.*', '.*', '.*', + '.*', '.*')"/> Date: Fri, 6 Mar 2015 15:01:00 +0100 Subject: [PATCH 03/15] Add css:computed-properties function --- .../xml/transform/block-translator-template.xsl | 4 ++-- .../css-core/src/main/resources/xml/base.xsl | 17 +++++++++++++++++ .../xml/transform/liblouis-block-translate.xsl | 4 ++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/pipeline-braille-utils/css-utils/src/main/resources/xml/transform/block-translator-template.xsl b/pipeline-braille-utils/css-utils/src/main/resources/xml/transform/block-translator-template.xsl index 4ea085e5c..275a9daf1 100644 --- a/pipeline-braille-utils/css-utils/src/main/resources/xml/transform/block-translator-template.xsl +++ b/pipeline-braille-utils/css-utils/src/main/resources/xml/transform/block-translator-template.xsl @@ -77,8 +77,8 @@ + css:computed-properties($inline-properties, false(), $this) + [not(@value=css:initial-value(@name))]))"/> diff --git a/pipeline-braille-utils/css/css-core/src/main/resources/xml/base.xsl b/pipeline-braille-utils/css/css-core/src/main/resources/xml/base.xsl index 22b670cd4..1a266e091 100644 --- a/pipeline-braille-utils/css/css-core/src/main/resources/xml/base.xsl +++ b/pipeline-braille-utils/css/css-core/src/main/resources/xml/base.xsl @@ -409,6 +409,12 @@ + + + + + + @@ -456,6 +462,17 @@ + + + + + + + + + + diff --git a/pipeline-braille-utils/liblouis-utils/src/main/resources/xml/transform/liblouis-block-translate.xsl b/pipeline-braille-utils/liblouis-utils/src/main/resources/xml/transform/liblouis-block-translate.xsl index 4828c5e6c..e4389d32a 100755 --- a/pipeline-braille-utils/liblouis-utils/src/main/resources/xml/transform/liblouis-block-translate.xsl +++ b/pipeline-braille-utils/liblouis-utils/src/main/resources/xml/transform/liblouis-block-translate.xsl @@ -15,8 +15,8 @@ - + select="css:computed-properties($inline-properties, true(), parent::*)"/> + From fcf9e9eb0957e599bcc73b8267d42a48cd8fd367 Mon Sep 17 00:00:00 2001 From: Bert Frees Date: Fri, 6 Mar 2015 15:37:33 +0100 Subject: [PATCH 04/15] Implement special inheritance of text-transform --- .../src/main/resources/xml/braille-css.xsl | 25 +++++++++++++++++++ .../src/test/xspec/test_braille-css.xspec | 17 +++++++++++++ .../xspec/test_liblouis-block-translate.xspec | 21 ++++++++++++++++ 3 files changed, 63 insertions(+) diff --git a/pipeline-braille-utils/css/css-core/src/main/resources/xml/braille-css.xsl b/pipeline-braille-utils/css/css-core/src/main/resources/xml/braille-css.xsl index db2f565cf..7a8d6aa85 100644 --- a/pipeline-braille-utils/css/css-core/src/main/resources/xml/braille-css.xsl +++ b/pipeline-braille-utils/css/css-core/src/main/resources/xml/braille-css.xsl @@ -260,6 +260,31 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/pipeline-braille-utils/css/css-core/src/test/xspec/test_braille-css.xspec b/pipeline-braille-utils/css/css-core/src/test/xspec/test_braille-css.xspec index 60dbef9b9..56237e9bf 100644 --- a/pipeline-braille-utils/css/css-core/src/test/xspec/test_braille-css.xspec +++ b/pipeline-braille-utils/css/css-core/src/test/xspec/test_braille-css.xspec @@ -322,4 +322,21 @@ + + + + + + <_ css:text-transform="bold"> + <_> + + + + + + + + + + diff --git a/pipeline-braille-utils/liblouis-utils/src/test/xspec/test_liblouis-block-translate.xspec b/pipeline-braille-utils/liblouis-utils/src/test/xspec/test_liblouis-block-translate.xspec index 8622aa3b1..818eb7b19 100644 --- a/pipeline-braille-utils/liblouis-utils/src/test/xspec/test_liblouis-block-translate.xspec +++ b/pipeline-braille-utils/liblouis-utils/src/test/xspec/test_liblouis-block-translate.xspec @@ -23,4 +23,25 @@ + + + +

+ + foo bar + +

+
+
+ + +

+ + ⠋⠕⠕ ⠃⠜ + +

+
+
+
+ From b9a9343a4d5a0973e37b6852bd73f1ee52454f94 Mon Sep 17 00:00:00 2001 From: Bert Frees Date: Tue, 10 Mar 2015 13:50:07 +0100 Subject: [PATCH 05/15] liblouis-core: fix warnings about hyphens and text-transform properties --- .../braille/liblouis/impl/LiblouisJnaImpl.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pipeline-braille-utils/liblouis/liblouis-core/src/main/java/org/daisy/pipeline/braille/liblouis/impl/LiblouisJnaImpl.java b/pipeline-braille-utils/liblouis/liblouis-core/src/main/java/org/daisy/pipeline/braille/liblouis/impl/LiblouisJnaImpl.java index 5c1703878..4e63b550d 100644 --- a/pipeline-braille-utils/liblouis/liblouis-core/src/main/java/org/daisy/pipeline/braille/liblouis/impl/LiblouisJnaImpl.java +++ b/pipeline-braille-utils/liblouis/liblouis-core/src/main/java/org/daisy/pipeline/braille/liblouis/impl/LiblouisJnaImpl.java @@ -298,12 +298,16 @@ public String[] transform(String[] text, String[] cssStyle) { boolean[] hyphenate = new boolean[cssStyle.length]; for (int i = 0; i < cssStyle.length; i++) { Map style = CSS_PARSER.split(cssStyle[i]); - typeform[i] = typeformFromInlineCSS(style); - if (style.containsKey("text-transform")) - typeform[i] |= typeformFromTextTransform(style.get("text-transform")); + String val = style.remove("text-transform"); + typeform[i] = Typeform.PLAIN; + if (val != null) + typeform[i] |= typeformFromTextTransform(val); + style.remove("hyphens"); hyphenate[i] = false; - if (style.containsKey("hyphens") && "auto".equals(style.get("hyphens"))) - hyphenate[i] = true; } + if (val != null) + if ("auto".equals(val)) + hyphenate[i] = true; + typeform[i] |= typeformFromInlineCSS(style);} return transform(text, typeform, hyphenate); } From b04a216888b72c1879eb4e96563997a7b0933323 Mon Sep 17 00:00:00 2001 From: Bert Frees Date: Tue, 5 May 2015 17:10:34 +0200 Subject: [PATCH 06/15] fixup b9a9343 --- .../pipeline/braille/liblouis/impl/LiblouisJnaImpl.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pipeline-braille-utils/liblouis/liblouis-core/src/main/java/org/daisy/pipeline/braille/liblouis/impl/LiblouisJnaImpl.java b/pipeline-braille-utils/liblouis/liblouis-core/src/main/java/org/daisy/pipeline/braille/liblouis/impl/LiblouisJnaImpl.java index 4e63b550d..9c52ec0f3 100644 --- a/pipeline-braille-utils/liblouis/liblouis-core/src/main/java/org/daisy/pipeline/braille/liblouis/impl/LiblouisJnaImpl.java +++ b/pipeline-braille-utils/liblouis/liblouis-core/src/main/java/org/daisy/pipeline/braille/liblouis/impl/LiblouisJnaImpl.java @@ -5,6 +5,7 @@ import java.net.URL; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; @@ -297,12 +298,12 @@ public String[] transform(String[] text, String[] cssStyle) { byte[] typeform = new byte[cssStyle.length]; boolean[] hyphenate = new boolean[cssStyle.length]; for (int i = 0; i < cssStyle.length; i++) { - Map style = CSS_PARSER.split(cssStyle[i]); + Map style = new HashMap(CSS_PARSER.split(cssStyle[i])); String val = style.remove("text-transform"); typeform[i] = Typeform.PLAIN; if (val != null) typeform[i] |= typeformFromTextTransform(val); - style.remove("hyphens"); + val = style.remove("hyphens"); hyphenate[i] = false; if (val != null) if ("auto".equals(val)) From 55959d2f55169aae4ce94a609b9d27932e5511c6 Mon Sep 17 00:00:00 2001 From: Bert Frees Date: Tue, 5 May 2015 19:22:34 +0200 Subject: [PATCH 07/15] liblouis-core: fix typeform offset bug --- .../daisy/pipeline/braille/liblouis/impl/LiblouisJnaImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pipeline-braille-utils/liblouis/liblouis-core/src/main/java/org/daisy/pipeline/braille/liblouis/impl/LiblouisJnaImpl.java b/pipeline-braille-utils/liblouis/liblouis-core/src/main/java/org/daisy/pipeline/braille/liblouis/impl/LiblouisJnaImpl.java index 9c52ec0f3..534d74eca 100644 --- a/pipeline-braille-utils/liblouis/liblouis-core/src/main/java/org/daisy/pipeline/braille/liblouis/impl/LiblouisJnaImpl.java +++ b/pipeline-braille-utils/liblouis/liblouis-core/src/main/java/org/daisy/pipeline/braille/liblouis/impl/LiblouisJnaImpl.java @@ -370,10 +370,10 @@ public String[] transform(String[] text, byte[] typeform, boolean[] hyphenate) { int i = 0; while (unhyphenated[i].length() == 0) i++; for (int j = 0; j < _typeform.length; j++) { + _typeform[j] = typeform[i]; if (positions != null && j < positions.length && (positions[j] & 4) == 4) { i++; - while (unhyphenated[i].length() == 0) i++; } - _typeform[j] = typeform[i]; } + while (unhyphenated[i].length() == 0) i++; }} break; } try { From 9d0ee45e703dadd51b3c6b6ac411de11a609dedc Mon Sep 17 00:00:00 2001 From: Davy Kager Date: Thu, 11 Jun 2015 11:05:52 +0200 Subject: [PATCH 08/15] css-core: Add predefined values for text-transform. --- .../css/BrailleCSSDeclarationTransformer.java | 21 +------------------ .../daisy/braille/css/BrailleCSSProperty.java | 2 +- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/pipeline-braille-utils/css/css-core/src/main/java/org/daisy/braille/css/BrailleCSSDeclarationTransformer.java b/pipeline-braille-utils/css/css-core/src/main/java/org/daisy/braille/css/BrailleCSSDeclarationTransformer.java index aac30ed7d..d796e9a44 100644 --- a/pipeline-braille-utils/css/css-core/src/main/java/org/daisy/braille/css/BrailleCSSDeclarationTransformer.java +++ b/pipeline-braille-utils/css/css-core/src/main/java/org/daisy/braille/css/BrailleCSSDeclarationTransformer.java @@ -285,26 +285,7 @@ private boolean processTextIndent(Declaration d, @SuppressWarnings("unused") private boolean processTextTransform(Declaration d, Map properties, Map> values) { - - if (d.size() == 1 && genericOneIdent(TextTransform.class, d, properties)) - return true; - - TermList list = tf.createList(); - for (Term t : d.asList()) { - if (t instanceof TermIdent) { - String value = ((TermIdent)t).getValue().toLowerCase(); - if (!value.equals("auto")) - list.add(t); } - else - return false; - } - - if (list.isEmpty()) - return false; - - properties.put("text-transform", TextTransform.list_values); - values.put("text-transform", list); - return true; + return genericOneIdent(TextTransform.class, d, properties); } /**************************************************************** diff --git a/pipeline-braille-utils/css/css-core/src/main/java/org/daisy/braille/css/BrailleCSSProperty.java b/pipeline-braille-utils/css/css-core/src/main/java/org/daisy/braille/css/BrailleCSSProperty.java index ec3eef23a..8ad38616d 100644 --- a/pipeline-braille-utils/css/css-core/src/main/java/org/daisy/braille/css/BrailleCSSProperty.java +++ b/pipeline-braille-utils/css/css-core/src/main/java/org/daisy/braille/css/BrailleCSSProperty.java @@ -241,7 +241,7 @@ public String toString() { } public enum TextTransform implements BrailleCSSProperty { - list_values(""), AUTO("auto"), INHERIT("inherit"); + NONE("none"), AUTO("auto"), UPPERCASE("uppercase"), LOWERCASE("lowercase"), INHERIT("inherit"); private String text; From 33b18d2375606a4129a1ff9e8d82840070024246 Mon Sep 17 00:00:00 2001 From: Davy Kager Date: Thu, 11 Jun 2015 13:56:55 +0200 Subject: [PATCH 09/15] css-calabash: Code layout fixes. --- .../braille/css/calabash/CSSInlineStep.java | 43 ++++++++++++------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/pipeline-braille-utils/css/css-calabash/src/main/java/org/daisy/braille/css/calabash/CSSInlineStep.java b/pipeline-braille-utils/css/css-calabash/src/main/java/org/daisy/braille/css/calabash/CSSInlineStep.java index 0b0765ace..1cc9e1c83 100755 --- a/pipeline-braille-utils/css/css-calabash/src/main/java/org/daisy/braille/css/calabash/CSSInlineStep.java +++ b/pipeline-braille-utils/css/css-calabash/src/main/java/org/daisy/braille/css/calabash/CSSInlineStep.java @@ -112,10 +112,12 @@ public void run() throws SaxonApiException { XdmNode source = sourcePipe.read(); Document doc = (Document)DocumentOverNodeInfo.wrap(source.getUnderlyingNode()); URL defaultSheet = asURL(emptyToNull(getOption(_default_stylesheet, ""))); - resultPipe.write((new InlineCSSWriter(doc, runtime, defaultSheet)).getResult()); } + resultPipe.write((new InlineCSSWriter(doc, runtime, defaultSheet)).getResult()); + } catch (Exception e) { logger.error("css:inline failed", e); - throw new XProcException(step.getNode(), e); } + throw new XProcException(step.getNode(), e); + } } @Component( @@ -202,7 +204,8 @@ else if (attr.getPrefix() != null) addAttribute(new QName(attr.getPrefix(), attr.getNamespaceURI(), attr.getLocalName()), attr.getNodeValue()); else if ("style".equals(attr.getLocalName())) {} else - addAttribute(new QName(attr.getNamespaceURI(), attr.getLocalName()), attr.getNodeValue()); } + addAttribute(new QName(attr.getNamespaceURI(), attr.getLocalName()), attr.getNodeValue()); + } StringBuilder style = new StringBuilder(); NodeData brailleData = brailleStylemap.get((Element)node); if (brailleData != null) @@ -226,17 +229,20 @@ else if ("style".equals(attr.getLocalName())) {} else page = pages.get(pageProperty.toString()); if (page != null) - insertPageStyle(style, page, pages.get("auto")); } + insertPageStyle(style, page, pages.get("auto")); + } else if (isRoot) { RulePage page = pages.get("auto"); if (page != null) - insertPageStyle(style, page, null); } - if (normalizeSpace(style).length() > 0) { - addAttribute(_style, style.toString().trim()); } + insertPageStyle(style, page, null); + } + if (normalizeSpace(style).length() > 0) + addAttribute(_style, style.toString().trim()); receiver.startContent(); for (Node child = node.getFirstChild(); child != null; child = child.getNextSibling()) traverse(child); - addEndElement(); } + addEndElement(); + } else if (node.getNodeType() == Node.COMMENT_NODE) addComment(node.getNodeValue()); else if (node.getNodeType() == Node.TEXT_NODE) @@ -256,7 +262,8 @@ public void addStartElement(Element element) { List namespaces = new ArrayList(); Iterators.addAll(namespaces, NamespaceIterator.iterateNamespaces(inode)); inscopeNS = Iterables.toArray(namespaces, NamespaceBinding.class); - seenRoot = true; } + seenRoot = true; + } receiver.setSystemId(element.getBaseURI()); addStartElement(new NameOfNode(inode), inode.getSchemaType(), inscopeNS); } @@ -282,14 +289,17 @@ private static void insertStyle(StringBuilder builder, NodeData nodeData) { builder.append(termToString.apply(value)); else { CSSProperty prop = nodeData.getProperty(key); - builder.append(prop); } - builder.append("; "); } + builder.append(prop); + } + builder.append("; "); + } } private static void insertPseudoStyle(StringBuilder builder, NodeData nodeData, Selector.PseudoDeclaration decl) { if (builder.length() > 0 && !builder.toString().endsWith("} ")) { builder.insert(0, "{ "); - builder.append("} "); } + builder.append("} "); + } builder.append(decl.isPseudoElement() ? "::" : ":").append(decl.value()).append(" { "); insertStyle(builder, nodeData); builder.append("} "); @@ -298,7 +308,8 @@ private static void insertPseudoStyle(StringBuilder builder, NodeData nodeData, private static void insertPageStyle(StringBuilder builder, RulePage rulePage, RulePage inheritFrom) { if (builder.length() > 0 && !builder.toString().endsWith("} ")) { builder.insert(0, "{ "); - builder.append("} "); } + builder.append("} "); + } builder.append("@page "); String pseudo = rulePage.getPseudo(); if (pseudo != null && !"".equals(pseudo)) @@ -307,7 +318,8 @@ private static void insertPageStyle(StringBuilder builder, RulePage rulePage, Ru List seen = new ArrayList(); for (Declaration decl : Iterables.filter(rulePage, Declaration.class)) { seen.add(decl.getProperty()); - insertDeclaration(builder, decl); } + insertDeclaration(builder, decl); + } if (inheritFrom != null) for (Declaration decl : Iterables.filter(inheritFrom, Declaration.class)) if (!seen.contains(decl.getProperty())) @@ -315,7 +327,8 @@ private static void insertPageStyle(StringBuilder builder, RulePage rulePage, Ru seen.clear(); for (RuleMargin margin : Iterables.filter(rulePage, RuleMargin.class)) { seen.add(margin.getMarginArea().value); - insertMarginStyle(builder, margin); } + insertMarginStyle(builder, margin); + } if (inheritFrom != null) for (RuleMargin margin : Iterables.filter(inheritFrom, RuleMargin.class)) if (!seen.contains(margin.getMarginArea().value)) From b000f66a60172fe921a265f447c13c5953c92e1e Mon Sep 17 00:00:00 2001 From: Davy Kager Date: Thu, 11 Jun 2015 14:36:59 +0200 Subject: [PATCH 10/15] css-core: Sync text-transform parameters. --- .../css/css-core/src/main/resources/xml/braille-css.xsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipeline-braille-utils/css/css-core/src/main/resources/xml/braille-css.xsl b/pipeline-braille-utils/css/css-core/src/main/resources/xml/braille-css.xsl index 7a8d6aa85..8ad6af1fa 100644 --- a/pipeline-braille-utils/css/css-core/src/main/resources/xml/braille-css.xsl +++ b/pipeline-braille-utils/css/css-core/src/main/resources/xml/braille-css.xsl @@ -90,7 +90,7 @@ re:exact(re:or(('normal','pre-wrap','pre-line'))), re:exact(re:or(('auto','manual','none'))), re:exact(concat('(',$css:NON_NEGATIVE_INTEGER_RE,')\s+(',$css:NON_NEGATIVE_INTEGER_RE,')')), - re:exact(re:or(($css:IDENT_LIST_RE,'auto'))), + re:exact(re:or(('none','auto','uppercase','lowercase'))), re:exact(re:or(('normal','italic','oblique'))), re:exact(re:or(('normal','bold','100','200','300','400','500','600','700','800','900'))), re:exact(re:or(('none','underline','overline','line-through','blink'))), From 81875efb464942602ed1a5acc7f53cbf37090303 Mon Sep 17 00:00:00 2001 From: Davy Kager Date: Tue, 16 Jun 2015 11:47:45 +0200 Subject: [PATCH 11/15] css-core: Bring back the list type for text-transform. --- .../src/main/java/org/daisy/braille/css/BrailleCSSProperty.java | 2 +- .../css/css-core/src/main/resources/xml/braille-css.xsl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pipeline-braille-utils/css/css-core/src/main/java/org/daisy/braille/css/BrailleCSSProperty.java b/pipeline-braille-utils/css/css-core/src/main/java/org/daisy/braille/css/BrailleCSSProperty.java index 8ad38616d..7b673d5f8 100644 --- a/pipeline-braille-utils/css/css-core/src/main/java/org/daisy/braille/css/BrailleCSSProperty.java +++ b/pipeline-braille-utils/css/css-core/src/main/java/org/daisy/braille/css/BrailleCSSProperty.java @@ -241,7 +241,7 @@ public String toString() { } public enum TextTransform implements BrailleCSSProperty { - NONE("none"), AUTO("auto"), UPPERCASE("uppercase"), LOWERCASE("lowercase"), INHERIT("inherit"); + list_values(""), NONE("none"), AUTO("auto"), UPPERCASE("uppercase"), LOWERCASE("lowercase"), INHERIT("inherit"); private String text; diff --git a/pipeline-braille-utils/css/css-core/src/main/resources/xml/braille-css.xsl b/pipeline-braille-utils/css/css-core/src/main/resources/xml/braille-css.xsl index 8ad6af1fa..25bd0d6d4 100644 --- a/pipeline-braille-utils/css/css-core/src/main/resources/xml/braille-css.xsl +++ b/pipeline-braille-utils/css/css-core/src/main/resources/xml/braille-css.xsl @@ -90,7 +90,7 @@ re:exact(re:or(('normal','pre-wrap','pre-line'))), re:exact(re:or(('auto','manual','none'))), re:exact(concat('(',$css:NON_NEGATIVE_INTEGER_RE,')\s+(',$css:NON_NEGATIVE_INTEGER_RE,')')), - re:exact(re:or(('none','auto','uppercase','lowercase'))), + re:exact(re:or(($css:IDENT_LIST_RE,'none','auto','uppercase','lowercase'))), re:exact(re:or(('normal','italic','oblique'))), re:exact(re:or(('normal','bold','100','200','300','400','500','600','700','800','900'))), re:exact(re:or(('none','underline','overline','line-through','blink'))), From be8ef6b865ca8d60f244be45c24dae07969421ee Mon Sep 17 00:00:00 2001 From: Davy Kager Date: Tue, 16 Jun 2015 12:27:54 +0200 Subject: [PATCH 12/15] css-core: Reintroduce handling of list values for text-transform. --- .../css/BrailleCSSDeclarationTransformer.java | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/pipeline-braille-utils/css/css-core/src/main/java/org/daisy/braille/css/BrailleCSSDeclarationTransformer.java b/pipeline-braille-utils/css/css-core/src/main/java/org/daisy/braille/css/BrailleCSSDeclarationTransformer.java index d796e9a44..522502edf 100644 --- a/pipeline-braille-utils/css/css-core/src/main/java/org/daisy/braille/css/BrailleCSSDeclarationTransformer.java +++ b/pipeline-braille-utils/css/css-core/src/main/java/org/daisy/braille/css/BrailleCSSDeclarationTransformer.java @@ -285,7 +285,27 @@ private boolean processTextIndent(Declaration d, @SuppressWarnings("unused") private boolean processTextTransform(Declaration d, Map properties, Map> values) { - return genericOneIdent(TextTransform.class, d, properties); + if (d.size() == 1 && genericOneIdent(TextTransform.class, d, properties)) + return true; + + TermList list = tf.createList(); + for (Term t : d.asList()) { + if (t instanceof TermIdent) { + String value = ((TermIdent)t).getValue().toLowerCase(); + if (!value.equals("none") && !value.equals("auto") + && !value.equals("uppercase") && !value.equals("lowercase")) + list.add(t); + } + else + return false; + } + + if (list.isEmpty()) + return false; + + properties.put("text-transform", TextTransform.list_values); + values.put("text-transform", list); + return true; } /**************************************************************** From 5339c7dfdde45833a3cb1b1584c6ac25d8877e56 Mon Sep 17 00:00:00 2001 From: Davy Kager Date: Tue, 16 Jun 2015 14:28:15 +0200 Subject: [PATCH 13/15] Fix braces. TODO: Automate this for the entire package at some point. --- .../liblouis/impl/LiblouisJnaImpl.java | 123 ++++++++++++------ 1 file changed, 86 insertions(+), 37 deletions(-) diff --git a/pipeline-braille-utils/liblouis/liblouis-core/src/main/java/org/daisy/pipeline/braille/liblouis/impl/LiblouisJnaImpl.java b/pipeline-braille-utils/liblouis/liblouis-core/src/main/java/org/daisy/pipeline/braille/liblouis/impl/LiblouisJnaImpl.java index 534d74eca..2b2015404 100644 --- a/pipeline-braille-utils/liblouis/liblouis-core/src/main/java/org/daisy/pipeline/braille/liblouis/impl/LiblouisJnaImpl.java +++ b/pipeline-braille-utils/liblouis/liblouis-core/src/main/java/org/daisy/pipeline/braille/liblouis/impl/LiblouisJnaImpl.java @@ -92,11 +92,15 @@ public File[] invoke(String tableList, File base) { logger.debug("Resolved to " + join(resolved, ",")); else logger.error("Table could not be resolved"); - return resolved; }}; - Louis.getLibrary().lou_registerTableResolver(_tableResolver); } + return resolved; + } + }; + Louis.getLibrary().lou_registerTableResolver(_tableResolver); + } catch (Throwable e) { logger.error("liblouis service could not be loaded", e); - throw e; } + throw e; + } } @Deactivate @@ -117,7 +121,9 @@ protected void bindLibrary(BundledNativePath path) { if (libraryPath != null) { Louis.setLibraryPath(asFile(libraryPath)); nativePath = path; - logger.debug("Registering liblouis library: " + libraryPath); }} + logger.debug("Registering liblouis library: " + libraryPath); + } + } } protected void unbindLibrary(BundledNativePath path) { @@ -195,10 +201,14 @@ private Iterable get(final URI[] table, String hyphenator, L try { translators = Optional.fromNullable( new LiblouisTranslatorHyphenatorImpl(table) - ).asSet(); } + ).asSet(); + } catch (CompilationException e) { - logger.warn("Could not create translator for table: " + Arrays.toString(table), e); } - break; }} + logger.warn("Could not create translator for table: " + Arrays.toString(table), e); + } + break; + } + } String hyphenatorQuery = "(locale:" + locale + ")"; if (!"auto".equals(hyphenator)) hyphenatorQuery = hyphenatorQuery + "(hyphenator:" + hyphenator + ")"; @@ -209,18 +219,26 @@ private Iterable get(final URI[] table, String hyphenator, L hyphenators.get(hyphenatorQuery), new Function() { public LiblouisTranslator apply(Hyphenator hyphenator) { - try { return new LiblouisTranslatorImpl(table, hyphenator); } + try { return new LiblouisTranslatorImpl(table, hyphenator); + } catch (CompilationException e) { - logger.warn("Could not create translator for table: " + Arrays.toString(table), e); } - return null; }}), - Predicates.notNull())); } + logger.warn("Could not create translator for table: " + Arrays.toString(table), e); + } + return null; + } + }), + Predicates.notNull())); + } try { translators = Iterables.concat( translators, - Optional.fromNullable(new LiblouisTranslatorImpl(table)).asSet()); } + Optional.fromNullable(new LiblouisTranslatorImpl(table)).asSet()); + } catch (CompilationException e) { - logger.warn("Could not create translator for table: " + Arrays.toString(table), e); } - return translators; } + logger.warn("Could not create translator for table: " + Arrays.toString(table), e); + } + return translators; + } logger.debug("Could not resolve table: " + Arrays.toString(table)); return empty; } @@ -244,8 +262,12 @@ public Iterable delegate(String query) { tableProvider.get(locale), new Function>() { public Iterable apply(URI[] table) { - return LiblouisJnaImpl.this.get(table, hyphenator, locale); }})); - return empty; }}; + return LiblouisJnaImpl.this.get(table, hyphenator, locale); + } + })); + return empty; + } + }; public Iterable get(String query) { return provider.get(query); @@ -308,7 +330,8 @@ public String[] transform(String[] text, String[] cssStyle) { if (val != null) if ("auto".equals(val)) hyphenate[i] = true; - typeform[i] |= typeformFromInlineCSS(style);} + typeform[i] |= typeformFromInlineCSS(style); + } return transform(text, typeform, hyphenate); } @@ -346,7 +369,8 @@ public String[] transform(String[] text, byte[] typeform, boolean[] hyphenate) { boolean someNotHyphenate = false; for (int i = 0; i < hyphenate.length; i++) { if (hyphenate[i]) someHyphenate = true; - else someNotHyphenate = true; } + else someNotHyphenate = true; + } if (someHyphenate) { byte[] autoHyphens = doHyphenate(_text); if (someNotHyphenate) { @@ -360,9 +384,13 @@ public String[] transform(String[] text, byte[] typeform, boolean[] hyphenate) { for (int k = 0; k < unhyphenated[j].length() - 1; k++) autoHyphens[i++] = 0; if (i < autoHyphens.length) - autoHyphens[i++] = 0; }}} + autoHyphens[i++] = 0; + } + } + } for (int i = 0; i < autoHyphens.length; i++) - positions[i] += autoHyphens[i]; } + positions[i] += autoHyphens[i]; + } byte[] _typeform = null; for (byte b : typeform) if (b != Typeform.PLAIN) { @@ -373,8 +401,11 @@ public String[] transform(String[] text, byte[] typeform, boolean[] hyphenate) { _typeform[j] = typeform[i]; if (positions != null && j < positions.length && (positions[j] & 4) == 4) { i++; - while (unhyphenated[i].length() == 0) i++; }} - break; } + while (unhyphenated[i].length() == 0) i++; + } + } + break; + } try { // Translate @@ -395,7 +426,8 @@ public String[] transform(String[] text, byte[] typeform, boolean[] hyphenate) { for (String s : SEGMENT_SPLITTER.split(braille)) { rv[i++] = s; while (i < text.length && unhyphenated[i].length() == 0) - rv[i++] = ""; } + rv[i++] = ""; + } if (i == text.length) return rv; else { @@ -414,9 +446,11 @@ public String[] transform(String[] text, byte[] typeform, boolean[] hyphenate) { for (int j = 0; j < positions.length; j++) { if ((positions[j] & 4) == 4) { i++; - while (i < text.length && unhyphenated[i].length() == 0) i++; } + while (i < text.length && unhyphenated[i].length() == 0) i++; + } int n = (i % 31) + 1; - positions[j] |= (byte)(n << 3); } + positions[j] |= (byte)(n << 3); + } r = translator.translate(_text, positions, _typeform); braille = r.getBraille(); outputPositions = r.getHyphenPositions(); @@ -432,7 +466,9 @@ public String[] transform(String[] text, byte[] typeform, boolean[] hyphenate) { rv[i++] = b.toString(); b = new StringBuffer(); while (((n - i - 1) % 31) > 0) - rv[i++] = ""; }} + rv[i++] = ""; + } + } b.append(braille.charAt(braille.length() - 1)); rv[i++] = b.toString(); while (i < text.length && unhyphenated[i].length() == 0) @@ -440,9 +476,13 @@ public String[] transform(String[] text, byte[] typeform, boolean[] hyphenate) { if (i == text.length) return rv; else - throw new RuntimeException("Coding error"); }}} + throw new RuntimeException("Coding error"); + } + } + } catch (TranslationException e) { - throw new RuntimeException(e); } + throw new RuntimeException(e); + } } protected byte[] doHyphenate(String text) { @@ -453,9 +493,11 @@ protected byte[] doHyphenate(String text) { public String display(String braille) { try { - return translator.display(braille); } + return translator.display(braille); + } catch (TranslationException e) { - throw new RuntimeException(e); } + throw new RuntimeException(e); + } } } @@ -498,17 +540,22 @@ public String[] hyphenate(String text[]) { for (String s : SEGMENT_SPLITTER.split(_text)) { while (unhyphenated[i].length() == 0) rv[i++] = ""; - rv[i++] = s; } - while(i < text.length) + rv[i++] = s; + } + while (i < text.length) rv[i++] = ""; - return rv; } + return rv; + } } @Override protected byte[] doHyphenate(String text) { - try { return translator.hyphenate(text); } + try { + return translator.hyphenate(text); + } catch (TranslationException e) { - throw new RuntimeException(e); } + throw new RuntimeException(e); + } } } @@ -540,7 +587,8 @@ else if (prop.equals("font-weight") && value.equals("bold")) else if (prop.equals("text-decoration") && value.equals("underline")) typeform |= Typeform.UNDERLINE; else - logger.warn("Inline CSS property {} not supported", prop); } + logger.warn("Inline CSS property {} not supported", prop); + } return typeform; } @@ -569,7 +617,8 @@ else if (tt.equals("louis-under")) else if (tt.equals("louis-comp")) typeform |= Typeform.COMPUTER; else - logger.warn("text-transform: {} not supported", tt); } + logger.warn("text-transform: {} not supported", tt); + } return typeform; } From aef62045ba4bc57f127a390b1a1ec491dbe8474f Mon Sep 17 00:00:00 2001 From: Davy Kager Date: Tue, 16 Jun 2015 14:56:28 +0200 Subject: [PATCH 14/15] liblouis-core: Implement text-transform values uppercase and lowercase. --- .../liblouis/impl/LiblouisJnaImpl.java | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/pipeline-braille-utils/liblouis/liblouis-core/src/main/java/org/daisy/pipeline/braille/liblouis/impl/LiblouisJnaImpl.java b/pipeline-braille-utils/liblouis/liblouis-core/src/main/java/org/daisy/pipeline/braille/liblouis/impl/LiblouisJnaImpl.java index 2b2015404..f2eb13ef3 100644 --- a/pipeline-braille-utils/liblouis/liblouis-core/src/main/java/org/daisy/pipeline/braille/liblouis/impl/LiblouisJnaImpl.java +++ b/pipeline-braille-utils/liblouis/liblouis-core/src/main/java/org/daisy/pipeline/braille/liblouis/impl/LiblouisJnaImpl.java @@ -323,8 +323,10 @@ public String[] transform(String[] text, String[] cssStyle) { Map style = new HashMap(CSS_PARSER.split(cssStyle[i])); String val = style.remove("text-transform"); typeform[i] = Typeform.PLAIN; - if (val != null) + if (val != null) { + text[i] = textFromTextTransform(text[i], val); typeform[i] |= typeformFromTextTransform(val); + } val = style.remove("hyphens"); hyphenate[i] = false; if (val != null) @@ -561,7 +563,7 @@ protected byte[] doHyphenate(String text) { private final static Splitter.MapSplitter CSS_PARSER = Splitter.on(';').omitEmptyStrings().withKeyValueSeparator(Splitter.on(':').limit(2).trimResults()); - + /** * @parameter style An inline CSS style * @returns the corresponding typeform. Possible values are: @@ -593,6 +595,23 @@ else if (prop.equals("text-decoration") && value.equals("underline")) } private final static Splitter TEXT_TRANSFORM_PARSER = Splitter.on(' ').omitEmptyStrings().trimResults(); + + /** + * @parameter text The text to be transformed. + * @parameter textTransform A text-transform value as a space separated list of keywords. + * @returns the transformed text, or the original text if no transformations were performed. + */ + protected static String textFromTextTransform(String text, String textTransform) { + for (String tt : TEXT_TRANSFORM_PARSER.split(textTransform)) { + if (tt.equals("uppercase")) + text = text.toUpperCase(); + else if (tt.equals("lowercase")) + text = text.toLowerCase(); + else + logger.warn("text-transform: {} not supported", tt); + } + return text; + } /** * @parameter textTransform A text-transform value as a space separated list of keywords. From 824909fd66f00ecf4b1accc66ecea933952de789 Mon Sep 17 00:00:00 2001 From: Davy Kager Date: Thu, 18 Jun 2015 08:59:03 +0200 Subject: [PATCH 15/15] liblouis-core: Add more tests for text-transform. --- .../liblouis/impl/LiblouisJnaImplTest.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pipeline-braille-utils/liblouis/liblouis-core/src/test/java/org/daisy/pipeline/braille/liblouis/impl/LiblouisJnaImplTest.java b/pipeline-braille-utils/liblouis/liblouis-core/src/test/java/org/daisy/pipeline/braille/liblouis/impl/LiblouisJnaImplTest.java index 9f18f16e5..04fbe29cd 100644 --- a/pipeline-braille-utils/liblouis/liblouis-core/src/test/java/org/daisy/pipeline/braille/liblouis/impl/LiblouisJnaImplTest.java +++ b/pipeline-braille-utils/liblouis/liblouis-core/src/test/java/org/daisy/pipeline/braille/liblouis/impl/LiblouisJnaImplTest.java @@ -13,6 +13,22 @@ public void testTypeformFromInlineCSS() { LiblouisJnaImpl.typeformFromInlineCSS( " text-decoration: underline ;font-weight: bold ; hyphens:auto; color: #FF00FF ")); } + + @Test + public void testTextFromTextTransform() { + assertEquals("IK BEN MOOS", + LiblouisJnaImpl.textFromTextTransform("Ik ben Moos", + " uppercase ")); + assertEquals("ik ben moos", + LiblouisJnaImpl.textFromTextTransform("Ik ben Moos", + " lowercase ")); + assertEquals("ik ben moos", + LiblouisJnaImpl.textFromTextTransform("Ik ben Moos", + " uppercase lowercase ")); + assertEquals("Ik ben Moos", + LiblouisJnaImpl.textFromTextTransform("Ik ben Moos", + " foo bar ")); + } @Test public void testTypeformFromTextTransform() {