Skip to content

Commit da92843

Browse files
fix pwid bug
1 parent 1f725a5 commit da92843

1 file changed

Lines changed: 20 additions & 22 deletions

File tree

js/control.js

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -295,11 +295,12 @@ function buildRow(unichar){
295295
clone.querySelector(".cids").appendChild(cidcell)
296296
}
297297

298+
// Get cell template
299+
const templateCIDcell = document.querySelector("template#sample-cell");
300+
298301
if ("vert-CID" in uniMapping){
299302
for (let region in uniMapping["vert-CID"]){
300303
cid = uniMapping["vert-CID"][region]
301-
// Get cell template
302-
const templateCIDcell = document.querySelector("template#sample-cell");
303304
// Clone cell template
304305
const cidcell = templateCIDcell.content.firstElementChild.cloneNode(true);
305306

@@ -331,8 +332,6 @@ function buildRow(unichar){
331332
if ("HW-CID" in uniMapping){
332333
for (let region in uniMapping["HW-CID"]){
333334
cid = uniMapping["HW-CID"][region]
334-
// Get cell template
335-
const templateCIDcell = document.querySelector("template#sample-cell");
336335
// Clone cell template
337336
const cidcell = templateCIDcell.content.firstElementChild.cloneNode(true);
338337

@@ -360,30 +359,29 @@ function buildRow(unichar){
360359
}
361360

362361
if ("PW-CID" in uniMapping){
363-
// Get cell template
364-
const templateCIDcell = document.querySelector("template#sample-cell");
365-
// Clone cell template
366-
const cidcell = templateCIDcell.content.firstElementChild.cloneNode(true);
362+
for (let region in uniMapping["PW-CID"]){
363+
cid = uniMapping["PW-CID"][region]
364+
// Clone cell template
365+
const cidcell = templateCIDcell.content.firstElementChild.cloneNode(true);
367366

368-
cidInfo = fontAI0[uniMapping["PW-CID"]]
369-
cidName = cidInfo["name"]
370-
// set cell language
371-
cidcell.classList.add("cid-Mix")
372-
// set cell OT feature, must be english for proportional ver
373-
cidcell.querySelector(".cid-char").setAttribute("lang", "en")
374-
cidcell.querySelector(".cid-char").innerText = unichar
375-
376-
cidcell.querySelector(".cid-name").innerText = cidName
377-
cidcell.querySelector(".cid-cid").innerText = "\\" + uniMapping["PW-CID"]
367+
cidInfo = fontAI0[cid]
368+
cidName = cidInfo["name"]
369+
// set cell language
370+
cidcell.classList.add("cid-Mix")
371+
// set cell OT feature, must be english for proportional ver
372+
cidcell.querySelector(".cid-char").setAttribute("lang", "en")
373+
cidcell.querySelector(".cid-char").innerText = unichar
374+
375+
cidcell.querySelector(".cid-name").innerText = cidName
376+
cidcell.querySelector(".cid-cid").innerText = "\\" + cid
378377

379-
// add the cell into row
380-
clone.querySelector(".cids").appendChild(cidcell)
378+
// add the cell into row
379+
clone.querySelector(".cids").appendChild(cidcell)
380+
}
381381
}
382382

383383
if ("extra" in uniMapping) {
384384
for (let cidNum of uniMapping["extra"]) {
385-
// Get cell template
386-
const templateCIDcell = document.querySelector("template#sample-cell");
387385
// Clone cell template
388386
const cidcell = templateCIDcell.content.firstElementChild.cloneNode(true);
389387

0 commit comments

Comments
 (0)