Skip to content

Commit

Permalink
Merge pull request #321 from metanorma/fix/surrogate_pairs
Browse files Browse the repository at this point in the history
Fix/surrogate pairs
  • Loading branch information
Intelligent2013 authored Jan 20, 2025
2 parents 8d688c4 + 4a97c4d commit 047f5ec
Show file tree
Hide file tree
Showing 6 changed files with 505 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SHELL ?= /bin/bash
endif

#JAR_VERSION := $(shell mvn -q -Dexec.executable="echo" -Dexec.args='$${project.version}' --non-recursive exec:exec -DforceStdout)
JAR_VERSION := 2.12
JAR_VERSION := 2.13
JAR_FILE := mn2pdf-$(JAR_VERSION).jar

all: target/$(JAR_FILE)
Expand Down
10 changes: 5 additions & 5 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ You will need the Java Development Kit (JDK) version 8, Update 241 (8u241) or hi

[source,sh]
----
java -Xss5m -Xmx2048m -jar target/mn2pdf-2.12.jar --xml-file <XML-FileName> --xsl-file <XSLT-FileName> --pdf-file <Output-PDF-FileName> [--syntax-highlight]
java -Xss5m -Xmx2048m -jar target/mn2pdf-2.13.jar --xml-file <XML-FileName> --xsl-file <XSLT-FileName> --pdf-file <Output-PDF-FileName> [--syntax-highlight]
----

e.g.

[source,sh]
----
java -Xss5m -Xmx2048m -jar target/mn2pdf-2.12.jar --xml-file tests/G.191.xml --xsl-file tests/itu.recommendation.xsl --pdf-file tests/G.191.pdf
java -Xss5m -Xmx2048m -jar target/mn2pdf-2.13.jar --xml-file tests/G.191.xml --xsl-file tests/itu.recommendation.xsl --pdf-file tests/G.191.pdf
----

=== PDF encryption features
Expand Down Expand Up @@ -100,7 +100,7 @@ Update version in `pom.xml`, e.g.:
----
<groupId>org.metanorma.fop</groupId>
<artifactId>mn2pdf</artifactId>
<version>2.12</version>
<version>2.13</version>
<name>Metanorma XML to PDF converter</name>
----

Expand All @@ -111,8 +111,8 @@ Tag the same version in Git:

[source,xml]
----
git tag v2.12
git push origin v2.12
git tag v2.13
git push origin v2.13
----

Then the corresponding GitHub release will be automatically created at:
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.metanorma.fop</groupId>
<artifactId>mn2pdf</artifactId>
<version>2.12</version>
<version>2.13</version>
<name>Metanorma XML to PDF converter</name>
<packaging>jar</packaging>
<url>https://www.metanorma.org</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,9 @@ private static VerticalOrientation lookupOrientationInRanges(int c) {
for (int f = 0, t = n; f <= t; ) {
int m = (f + t) / 2;
int i = 2 * m;
if (i >= voRanges1.length) {
return null;
}
int c0 = voRanges1[i + 0];
int c1 = voRanges1[i + 1];
if (c1 < c) {
Expand All @@ -715,6 +718,8 @@ private static VerticalOrientation lookupOrientationInSingles(int c) {
if (n > 0) {
for (int f = 0, t = n; f <= t; ) {
int m = (f + t) >>> 1;
if (m >= voSingles1.length)
return null;
int c0 = voSingles1[m];
if (c0 < c) {
if ((f = m + 1) > n)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,7 @@ public List<KnuthSequence> getNextKnuthElements(final LayoutContext context, fin
boolean inWord = false;
boolean inWhitespace = false;
char ch = 0;
char prevChar = 0;
int level = -1;
int prevLevel = -1;
boolean retainControls = false;
Expand Down Expand Up @@ -831,7 +832,7 @@ public List<KnuthSequence> getNextKnuthElements(final LayoutContext context, fin
boolean processWord = breakOpportunity
|| GlyphMapping.isSpace(ch)
|| CharUtilities.isExplicitBreak(ch)
|| ((prevLevel != -1) && (level != prevLevel))
|| ((prevLevel != -1) && (level != prevLevel) && !Character.isHighSurrogate(prevChar))
|| inUpright;
if (!processWord && foText.getCommonFont().getFontSelectionStrategy() == EN_CHARACTER_BY_CHARACTER) {
if (lastFont == null || lastFontPos != nextStart - 1) {
Expand Down Expand Up @@ -904,6 +905,7 @@ public List<KnuthSequence> getNextKnuthElements(final LayoutContext context, fin
inWhitespace = ch == CharUtilities.SPACE
&& foText.getWhitespaceTreatment() != Constants.EN_PRESERVE;
prevLevel = level;
prevChar = ch;
nextStart++;
}

Expand Down
Loading

0 comments on commit 047f5ec

Please sign in to comment.