Fix kerning support

This commit is contained in:
Josh birnholz
2023-10-22 01:49:26 -04:00
parent 262d91ec3b
commit ac1ba1941a

View File

@@ -143,7 +143,7 @@ async function setBottomInfoStyle() {
if (document.querySelector('#enableNewCollectorStyle').checked) { if (document.querySelector('#enableNewCollectorStyle').checked) {
await loadBottomInfo({ await loadBottomInfo({
midLeft: {text:'{elemidinfo-set} \u2022 {elemidinfo-language} {savex}{fontbelerenbsc}{fontsize' + scaleHeight(0.001) + '}{upinline' + scaleHeight(0.0005) + '}\uFFEE{savex2}{elemidinfo-artist}', x:0.0647, y:0.9548, width:0.8707, height:0.0171, oneLine:true, font:'gothammedium', size:0.0171, color:'white', outlineWidth:0.003}, midLeft: {text:'{elemidinfo-set} \u2022 {elemidinfo-language} {savex}{fontbelerenbsc}{fontsize' + scaleHeight(0.001) + '}{upinline' + scaleHeight(0.0005) + '}\uFFEE{savex2}{elemidinfo-artist}', x:0.0647, y:0.9548, width:0.8707, height:0.0171, oneLine:true, font:'gothammedium', size:0.0171, color:'white', outlineWidth:0.003},
topLeft: {text:'{elemidinfo-rarity} {elemidinfo-number}', x:0.0647, y:0.9377, width:0.8707, height:0.0171, oneLine:true, font:'gothammedium', size:0.0171, color:'white', outlineWidth:0.003}, topLeft: {text:'{elemidinfo-rarity} {kerning3}{elemidinfo-number}{kerning0}', x:0.0647, y:0.9377, width:0.8707, height:0.0171, oneLine:true, font:'gothammedium', size:0.0171, color:'white', outlineWidth:0.003},
note: {text:'{loadx}{elemidinfo-note}', x:0.0647, y:0.9377, width:0.8707, height:0.0171, oneLine:true, font:'gothammedium', size:0.0171, color:'white', outlineWidth:0.003}, note: {text:'{loadx}{elemidinfo-note}', x:0.0647, y:0.9377, width:0.8707, height:0.0171, oneLine:true, font:'gothammedium', size:0.0171, color:'white', outlineWidth:0.003},
bottomLeft: {text:'NOT FOR SALE', x:0.0647, y:0.9719, width:0.8707, height:0.0143, oneLine:true, font:'gothammedium', size:0.0143, color:'white', outlineWidth:0.003}, bottomLeft: {text:'NOT FOR SALE', x:0.0647, y:0.9719, width:0.8707, height:0.0143, oneLine:true, font:'gothammedium', size:0.0143, color:'white', outlineWidth:0.003},
wizards: {name:'wizards', text:'{ptshift0,0.0172}\u2122 & \u00a9 {elemidinfo-year} Wizards of the Coast', x:0.0647, y:0.9377, width:0.8707, height:0.0167, oneLine:true, font:'mplantin', size:0.0162, color:'white', align:'right', outlineWidth:0.003}, wizards: {name:'wizards', text:'{ptshift0,0.0172}\u2122 & \u00a9 {elemidinfo-year} Wizards of the Coast', x:0.0647, y:0.9377, width:0.8707, height:0.0167, oneLine:true, font:'mplantin', size:0.0162, color:'white', align:'right', outlineWidth:0.003},
@@ -3488,7 +3488,7 @@ function writeText(textObject, targetContext) {
//Finish prepping canvases //Finish prepping canvases
paragraphContext.clearRect(0, 0, paragraphCanvas.width, paragraphCanvas.height); paragraphContext.clearRect(0, 0, paragraphCanvas.width, paragraphCanvas.height);
lineContext.clearRect(0, 0, lineCanvas.width, lineCanvas.height); lineContext.clearRect(0, 0, lineCanvas.width, lineCanvas.height);
lineCanvas.style.letterSpacing = (scaleWidth(textObject.kerning) || 0) + 'px'; lineContext.letterSpacing = (scaleWidth(textObject.kerning) || 0) + 'px';
// if (textFont == 'goudymedieval') { // if (textFont == 'goudymedieval') {
// lineCanvas.style.letterSpacing = '3.5px'; // lineCanvas.style.letterSpacing = '3.5px';
// } // }
@@ -3706,7 +3706,7 @@ function writeText(textObject, targetContext) {
} else if (possibleCode.includes('fixtextalign')) { } else if (possibleCode.includes('fixtextalign')) {
textAlign = realTextAlign; textAlign = realTextAlign;
} else if (possibleCode.includes('kerning')) { } else if (possibleCode.includes('kerning')) {
lineCanvas.style.letterSpacing = possibleCode.replace('kerning', '') + 'px'; lineContext.letterSpacing = possibleCode.replace('kerning', '') + 'px';
lineContext.font = lineContext.font; //necessary for the letterspacing update to be recognized lineContext.font = lineContext.font; //necessary for the letterspacing update to be recognized
} else if (getManaSymbol(possibleCode.replaceAll('/', '')) != undefined || getManaSymbol(possibleCode.replaceAll('/', '').split('').reverse().join('')) != undefined) { } else if (getManaSymbol(possibleCode.replaceAll('/', '')) != undefined || getManaSymbol(possibleCode.replaceAll('/', '').split('').reverse().join('')) != undefined) {
possibleCode = possibleCode.replaceAll('/', '') possibleCode = possibleCode.replaceAll('/', '')