xzel23 commented on code in PR #184:
URL: https://github.com/apache/pdfbox/pull/184#discussion_r1484481434
##########
fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java:
##########
@@ -75,6 +76,13 @@ public class GlyphSubstitutionTable extends TTFTable
private GsubData gsubData;
+ /**
+ * The regex represents 4 'word characters' [a-zA-Z_0-9],
+ * see {@link java.util.regex.ASCII#WORD}<br>
+ * Note: the ' '-character is not matched!
+ */
+ static final Pattern wordPattern = Pattern.compile( "\\w{4}" );
Review Comment:
The name should be all uppercase for constants (static final). It should
also be private.
##########
fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java:
##########
@@ -75,6 +76,13 @@ public class GlyphSubstitutionTable extends TTFTable
private GsubData gsubData;
+ /**
+ * The regex represents 4 'word characters' [a-zA-Z_0-9],
+ * see {@link java.util.regex.ASCII#WORD}<br>
+ * Note: the ' '-character is not matched!
+ */
+ static final Pattern wordPattern = Pattern.compile( "\\w{4}" );
Review Comment:
What do you think about making this a predicate?
```
private static final Predicate<String> IS_FOUR_LETTERS =
Pattern.compile( "\\w{4}" ).asMatchPredicate();
```
Then the test would be `IS_FOUR_LETTERS.test(featureTags[i])`.
##########
fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java:
##########
@@ -799,10 +806,11 @@ public int getSubstitution(int gid, String[] scriptTags,
List<String> enabledFea
}
/**
- * For a substitute-gid (obtained from {@link #getSubstitution(int,
String[], List)}), retrieve the original gid.
- *
- * Only gids previously substituted by this instance can be
un-substituted. If you are trying to unsubstitute before
- * you substitute, something is wrong.
+ * For a substitute-gid (obtained from {@link #getSubstitution(int,
String[], List)}),
+ * retrieve the original gid.
+ * <br>
Review Comment:
Usually `<p>` is used in Javadoc to start a new paragraph.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]