Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle rlig for latin script #564

Draft
wants to merge 60 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
09ba12f
feat: additional GPOS lookups parsers
rafallyczkowskiadylic Dec 19, 2022
5580fb6
feat: introduced glyphs positioning features (kern, mark)
rafallyczkowskiadylic Dec 19, 2022
6e07277
fix: code style fixes.
rafallyczkowskiadylic Dec 19, 2022
d1c3fd3
fix: kerning pos fix for pair
rafallyczkowskiadylic Dec 20, 2022
30ef17c
fix: kern processing value to support entire sequence
rafallyczkowskiadylic Dec 20, 2022
45b6f7e
refactored ligature feature application to diminish duplicate code
Connum Feb 14, 2023
2a2316e
apply rlig feature for latin script
Connum Feb 14, 2023
1fda5b6
add tests for rlig feature enabled/disabled for latin script
Connum Feb 14, 2023
da8fadd
force rlig feature to true in index.html demo
Connum Feb 14, 2023
de2582a
Merge branch 'master' into 554-latin-rlig
Connum Feb 27, 2023
5a596af
fix broken import after merge
Connum Feb 27, 2023
f79f539
fix test font file path
Connum Feb 27, 2023
46aa1e9
did I really forget to commit the test font and no-one noticed? ;)
Connum Feb 27, 2023
5ebb375
Merge branch 'master' into 554-latin-rlig
Connum Feb 28, 2023
951b9f9
Merge branch 'master' into feature/mtbase-merge-testing
rafallyczkowskiadylic Mar 5, 2023
0c78812
Merge branch 'master' into feature/mark-to-base-attachment-positioning
rafallyczkowskiadylic Mar 6, 2023
a48ceb6
fix: pointer offset fix, typos
rafallyczkowskiadylic Mar 6, 2023
89c8b46
Merge branch 'master' into feature/mark-to-base-attachment-positioning
rafallyczkowskiadylic Mar 7, 2023
c262bc9
fix: tests after merge
rafallyczkowskiadylic Mar 7, 2023
ca8e020
Merge branch 'master' into feature/mark-to-base-attachment-positioning
rafallyczkowskiadylic May 11, 2023
5485849
fix: fixed lint code after merge
rafallyczkowskiadylic May 11, 2023
d8fd81d
fix: Fixes the substitution algorithm and support for multiSubstituti…
rafallyczkowskiadylic May 12, 2023
d224142
fix: context condition check
rafallyczkowskiadylic May 12, 2023
6c68a11
fix: code linting and comments
rafallyczkowskiadylic May 12, 2023
0a8f62f
Merge pull request #5 from Adylic/bugfix/substitution-algorithm-fix
rafallyczkowskiadylic May 12, 2023
a0d961c
Merge branch 'master' into 554-latin-rlig
Connum Nov 6, 2023
f8165af
fix cmap table selection
Connum Nov 26, 2023
f6b74ac
implement reading, writing and drawing of CFF PaintType and StrokeWidth
Connum Nov 26, 2023
6dbc337
clarify test font license
Connum Nov 26, 2023
5840129
correct 2x2 glyf transformation (fix #432)
Connum Nov 26, 2023
4b97164
better browser/node detection
Connum Nov 27, 2023
61d9c26
add eslint-import rule no-cycle
Connum Nov 27, 2023
d97d4c2
Merge branch 'master' into fix/459
Connum Nov 27, 2023
dd419dd
Merge branch 'master' into fix/649
Connum Nov 27, 2023
f088185
Merge branch 'master' into fix/135
Connum Nov 27, 2023
0148ac8
Merge branch 'master' into fix/174
Connum Nov 27, 2023
972e122
Merge branch 'master' into dev/eslint-import-no-cycle
Connum Nov 27, 2023
6764f60
Update page.yml
Connum Nov 28, 2023
ec0eb8d
Update ci.yml
Connum Nov 28, 2023
bf814b9
Merge pull request #1 from opentypejs/dev/eslint-import-no-cycle
Connum Nov 28, 2023
64ed482
better browser/node detection #653
Connum Nov 28, 2023
ee93159
Merge remote-tracking branch 'upstream/pr/652' into next/main
Connum Nov 28, 2023
44def0f
Merge remote-tracking branch 'upstream/pr/651' into next/main
Connum Nov 28, 2023
1c1b060
Merge remote-tracking branch 'upstream/pr/650' into next/main
Connum Nov 28, 2023
e4af4a3
add unicode-report workflow
Connum Nov 28, 2023
e846aa0
Create report-counter.js
Connum Nov 28, 2023
d556936
Add files via upload
Connum Nov 28, 2023
2b74a2f
Update unicode-report.yml
Connum Nov 28, 2023
76449ab
Merge branch 'main' of https://github.com/Connum/opentype.js-next int…
Connum Nov 28, 2023
09ce9ac
Merge branch 'feature/mark-to-base-attachment-positioning' of https:/…
Connum Nov 28, 2023
0abc7f0
Update unicode-report.yml to allow manual dispatch
Connum Nov 28, 2023
f729b67
Update unicode-report.yml
Connum Nov 28, 2023
8418dca
Update unicode-report.yml
Connum Nov 28, 2023
2b6e8bd
Update unicode-report.yml
Connum Nov 28, 2023
910e5a9
Update unicode-report.yml
Connum Nov 28, 2023
c32a2a5
Update unicode-report.yml
Connum Nov 28, 2023
7a9d626
Update unicode-report.yml
Connum Nov 30, 2023
7e3de52
Update unicode-report.yml
Connum Nov 30, 2023
75930f9
Update unicode-report.yml
Connum Nov 30, 2023
c6a9f23
Merge branch 'main' into 554-latin-rlig
Connum Nov 30, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
- main
pull_request:

jobs:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/page.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
- main

permissions:
pages: write
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/scripts/report-counter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
const jsdom = require("jsdom");
const { JSDOM } = jsdom;

JSDOM.fromFile(process.env.REPORT_FILE).then(dom => {
const document = dom.window.document;

function prevUntil(element, selector) {
const elements = [];
while(element.previousElementSibling && !element.previousElementSibling.matches(selector)) {
element = element.previousElementSibling;
elements.push(element);
}
elements.push(element.previousElementSibling);
return elements;
}

function outputStats(variableFonts = false) {
console.log(variableFonts ? '**Variable Fonts**' : '**Basic Features**');

const testCaseTables = Array.from(document.querySelectorAll('.desc+table')).filter((table) => {
const prev = prevUntil(table, 'h3');
const headline = prev.pop();

const isVariableRelated = /^.VAR/.test(headline.textContent.trim()) || prev.find(d => /variable font|axis/i.test(d.textContent));

const returnValue = (variableFonts && isVariableRelated) || (!variableFonts && !isVariableRelated);

// if (returnValue) {
// console.log(headline.textContent.trim());
// }

return returnValue;
});

// console.log(testCaseTables);

const casesCount = testCaseTables.length;
const failingCases = testCaseTables.filter(t => t.querySelectorAll('.conformance-fail').length).length;
const passingCases = casesCount - failingCases;

const single_passing = document.querySelectorAll(".conformance-pass");
const single_failing = document.querySelectorAll(".conformance-fail");

console.log(`✔ PASS: ${passingCases}`);
console.log(`❌ FAIL: ${failingCases}`);

const blockCount = 12;
const done = casesCount ? passingCases/casesCount : 0;
const blocksPassing = Math.round(done*blockCount);
const blobksFailing = 12 - blocksPassing;

console.log(`${'🟩'.repeat(blocksPassing)}${'⬛'.repeat(blobksFailing)} ${(done*100).toFixed(2)}%\n\n`);
}

outputStats();
outputStats(true);
});
149 changes: 149 additions & 0 deletions .github/workflows/unicode-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
name: Run Unicode Test Suite

on:
# push:
# branches:
# - master
# - main

pull_request:
branches:
- master
- main
types: [ opened, synchronize, reopened ]

workflow_dispatch:

permissions:
pull-requests: write
contents: write

jobs:
test:
runs-on: ubuntu-latest

env:
PUSH_TO_MAIN: ${{ github.event_name == 'push' && ( github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' ) }}
COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
MANUAL_DISPATCH: ${{ github.event_name == 'workflow_dispatch' }}
SHORT_COMMIT_SHA: ''
ARTIFACT_URL: ''
REPORT_DIR: 'docs/reports'
REPORT_FILE: ''
REPORT_SUMMARY: ''

steps:

- name: Checkout code
if: ${{ env.PUSH_TO_MAIN == 'false' && env.MANUAL_DISPATCH == 'false' }}
uses: actions/checkout@v4
- name: Checkout code (full-depth)
if: ${{ env.PUSH_TO_MAIN == 'true' || env.MANUAL_DISPATCH == 'true' }}
uses: actions/checkout@v4
with:
# important in order to make amending not break the history
fetch-depth: 0

- name: Get current commit
if: ${{ env.MANUAL_DISPATCH == 'true' }}
run: |
COMMIT_SHA=$(git rev-parse HEAD)
echo "COMMIT_SHA=$COMMIT_SHA" >> $GITHUB_ENV

- name: Get parent commit
if: ${{ env.PUSH_TO_MAIN == 'true' }}
run: |
COMMIT_SHA=$(git rev-parse HEAD^1)
echo "COMMIT_SHA=$COMMIT_SHA" >> $GITHUB_ENV

- name: Set environment variables
run: |
SHORT_COMMIT_SHA=$(echo "${{ env.COMMIT_SHA }}" | cut -c 1-7)
echo "SHORT_COMMIT_SHA=$SHORT_COMMIT_SHA" >> $GITHUB_ENV
echo "REPORT_FILE=${{ env.REPORT_DIR }}/${{ env.COMMIT_SHA }}.html" >> $GITHUB_ENV

- name: Setup node
uses: actions/setup-node@v4

- run: npm install -D jsdom

# - name: Setup ninja
# uses: seanmiddleditch/gha-setup-ninja@master

- name: Clone and install text-rendering-tests repository
run: |
git clone https://github.com/unicode-org/text-rendering-tests.git
cd text-rendering-tests
npm install

- name: Ensure reports directory exists
run: mkdir -p ${{ env.REPORT_DIR }}

# for speeding up the workflow when debugging this action
# - name: Delete HTML files in testcases directory
# run: |
# find text-rendering-tests/testcases -name '*.html' -not -name 'index.html' -not -name 'GPOS-*.html' -delete

- name: build files and copy to text script
run: |
npm run build
mv bin/test-render text-rendering-tests/node_modules/opentype.js/bin/
mv dist/* text-rendering-tests/node_modules/opentype.js/dist/

- name: Run check.py script
run: |
cd text-rendering-tests
python check.py --engine=OpenType.js --output="../${{ env.REPORT_FILE }}"

- name: Replace version with commit hash and link to PR commit, fix font links
run: |
if [[ "${{ github.event_name }}" == 'pull_request' ]]; then
COMMIT_URL="https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }}/commits/${{ env.COMMIT_SHA }}"
else
COMMIT_URL="https://github.com/${{ github.repository }}/commit/${{ env.COMMIT_SHA }}"
fi

sed -i -E "s@OpenType\.js(\xC2\xA0| )[0-9.]+@<a href=\"$COMMIT_URL\">${{ github.repository }}#${{ env.SHORT_COMMIT_SHA }}</a>@" ${{ env.REPORT_FILE }}
sed -i -E "s@href=\"\.\./fonts/@href=\"https://rawgit.com/unicode-org/text-rendering-tests/master/fonts/@" ${{ env.REPORT_FILE }}

- name: parse passing/failing tests
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
REPORT_SUMMARY=$(node .github/workflows/scripts/report-counter.js)
echo "REPORT_SUMMARY<<$EOF" >> $GITHUB_ENV
echo "$REPORT_SUMMARY" >> $GITHUB_ENV
echo "$EOF" >> $GITHUB_ENV

- name: Upload build artifact
if: ${{ env.PUSH_TO_MAIN == 'false' }}
uses: actions/upload-artifact@v3
with:
name: unicode-text-rendering-report_${{ env.SHORT_COMMIT_SHA }}
path: ${{ env.REPORT_FILE }}

- name: Get artifact link
if: ${{ env.PUSH_TO_MAIN == 'false' && env.MANUAL_DISPATCH == 'false' }}
run: |
ARTIFACT_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}#artifacts"
echo "ARTIFACT_URL=$ARTIFACT_URL" >> $GITHUB_ENV

- name: Add or update status report comment
if: ${{ env.PUSH_TO_MAIN == 'false' && env.MANUAL_DISPATCH == 'false' }}
uses: thollander/[email protected]
with:
message: |
ℹ Automatic [Unicode test suite](https://github.comunicode-org/text-rendering-tests) report for commit ${{ env.SHORT_COMMIT_SHA}}:

${{ env.REPORT_SUMMARY }}

[download report](${{ env.ARTIFACT_URL }})
comment_tag: unicode_test_report

- name: Amend report file to commit
if: ${{ env.PUSH_TO_MAIN == 'true' }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "github-actions"
git add "${{ env.REPORT_FILE }}"
git commit --amend --no-edit
git push --force-with-lease
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ See [https://opentype.js.org/](https://opentype.js.org/) for a live demo.
* Support for composite glyphs (accented letters).
* Support for WOFF, OTF, TTF (both with TrueType `glyf` and PostScript `cff` outlines)
* Support for kerning (Using GPOS or the kern table).
* Support for Mark-to-Base Attachment Positioning.
* Support for ligatures.
* Support for TrueType font hinting.
* Support arabic text rendering (See issue #364 & PR #359 #361)
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ <h1>Free Software</h1>
hinting: form.hinting.checked,
features: {
liga: form.ligatures.checked,
rlig: form.ligatures.checked
rlig: true
}
};
previewCtx.clearRect(0, 0, 940, 300);
Expand Down
Loading
Loading