-
Notifications
You must be signed in to change notification settings - Fork 487
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement ccmp feature execution, enabling muti character emoji support
- Loading branch information
Showing
10 changed files
with
272 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { ContextParams } from '../../tokenizer.js'; | ||
import applySubstitution from '../applySubstitution.js'; | ||
|
||
// @TODO: use commonFeatureUtils.js for reduction of code duplication | ||
// once #564 has been merged. | ||
|
||
/** | ||
* Update context params | ||
* @param {any} tokens a list of tokens | ||
* @param {number} index current item index | ||
*/ | ||
function getContextParams(tokens, index) { | ||
const context = tokens.map(token => token.activeState.value); | ||
return new ContextParams(context, index || 0); | ||
} | ||
|
||
/** | ||
* Apply ccmp replacement ligatures to a context range | ||
* @param {ContextRange} range a range of tokens | ||
*/ | ||
function ccmpReplacementLigatures(range) { | ||
const script = 'delf'; | ||
const tag = 'ccmp'; | ||
let tokens = this.tokenizer.getRangeTokens(range); | ||
let contextParams = getContextParams(tokens); | ||
for(let index = 0; index < contextParams.context.length; index++) { | ||
if (!this.query.getFeature({tag, script, contextParams})){ | ||
continue; | ||
} | ||
contextParams.setCurrentIndex(index); | ||
let substitutions = this.query.lookupFeature({ | ||
tag, script, contextParams | ||
}); | ||
if (substitutions.length) { | ||
for(let i = 0; i < substitutions.length; i++) { | ||
const action = substitutions[i]; | ||
applySubstitution(action, tokens, index); | ||
} | ||
contextParams = getContextParams(tokens); | ||
} | ||
} | ||
} | ||
|
||
export default ccmpReplacementLigatures; | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
function ccmpReplacementStartCheck(contextParams) { | ||
return contextParams.index === 0 && contextParams.context.length > 1; | ||
} | ||
|
||
function ccmpReplacementEndCheck(contextParams) { | ||
return contextParams.index === contextParams.context.length - 1; | ||
} | ||
|
||
export default { | ||
startCheck: ccmpReplacementStartCheck, | ||
endCheck: ccmpReplacementEndCheck | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,16 @@ Jomhuria-Regular.ttf | |
SIL Open Font License, Version 1.1. | ||
https://www.fontsquirrel.com/license/jomhuria | ||
|
||
liga-sub5.ttf | ||
Copyright 2024, Tao Qin (https://glyphsapp.com/). | ||
SIL Open Font License, Version 1.1. | ||
https://opensource.org/licenses/OFL-1.1 | ||
|
||
noto-emoji.ttf | ||
Copyright 2021, Google Inc. | ||
SIL Open Font License, version 1.1 | ||
http://scripts.sil.org/OFL | ||
|
||
OpenMojiCOLORv0-subset.ttf | ||
All emojis designed by OpenMoji – the open-source emoji and icon project. | ||
Creative Commons Share Alike License 4.0 (CC BY-SA 4.0) | ||
|
@@ -87,4 +97,4 @@ TestGVAR-Composite-0-Missing.ttf | |
Vibur.woff | ||
Copyright (c) 2010, Johan Kallas ([email protected]). | ||
SIL Open Font License, Version 1.1 | ||
https://www.fontsquirrel.com/license/vibur | ||
https://www.fontsquirrel.com/license/vibur |
Binary file not shown.
Binary file not shown.