Skip to content

Commit

Permalink
Fix the Khmer font issue.
Browse files Browse the repository at this point in the history
Update the font subset script.
List the characters needed in the document.
TODO: generate the non-Khmer subset font
  • Loading branch information
aphillips committed Jan 23, 2019
1 parent 8c1b3e8 commit 9cbaf56
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 14 deletions.
Binary file added NotoSansKhmer-Regular.woff
Binary file not shown.
27 changes: 15 additions & 12 deletions SubsetFont.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
// @grant none
// ==/UserScript==

// author = addison@lab126.com
// author = addison@amazon.com

var text = document.body.innerHTML;

var charsToGet = [];
var request = '';

var re = new RegExp("[\u0100-\uffff]", 'g');
var re = new RegExp("([\u0100-\ud7ff\ue000-\uffff]|[\ud800-\udbff][\udc00-\udfff])", 'g');

var unique = 0;

Expand All @@ -23,13 +23,14 @@ while ((m = re.exec(text)) !== null) {
var item = m[0];
if (charsToGet.length === 0 || charsToGet.indexOf(item) < 0) {
charsToGet.push(item);
request = request + item;
unique++;
}
}
charsToGet.sort();


//alert(re.test(text) + ' ' + re + ' ' + text.substring(0,100));
for (var i = 0; i < charsToGet.length; i++) {
request = request + charsToGet[i];
}

var mypanel = document.getElementsByClassName('subsetFont')[0];

Expand All @@ -40,12 +41,14 @@ mypanel.innerHTML = '';

mypanel.setAttribute('id', 'subsetFont');
mypanel.setAttribute('class', "subsetFont");
mypanel.style.position = 'fixed';
mypanel.style.bottom = 0;
mypanel.style.right = 0;
mypanel.style.overflow = 'auto';
mypanel.style.inset = '0 0 0 10px';
mypanel.style.zIndex = '1001'; // make it appear in front of most things
mypanel.style.position = 'fixed';
mypanel.style.bottom = 0;
mypanel.style.right = 0;
mypanel.style.background = 'white';
mypanel.style.border = '1px solid black';
mypanel.style.overflow = 'auto';
mypanel.style.inset = '0 0 0 10px';
mypanel.style.zIndex = '1001'; // make it appear in front of most things

var pre = document.createElement('pre');
pre.appendChild(document.createTextNode('count: ' + unique));
Expand All @@ -54,4 +57,4 @@ pre = document.createElement('pre');
pre.appendChild(document.createTextNode(request));
mypanel.appendChild(pre);

document.body.appendChild(mypanel);
document.body.appendChild(mypanel);
10 changes: 9 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
<html dir="ltr" lang="en">
<head>
<meta charset="UTF-8">

<!--
Editor's note: the current list of Unicode characters used in this document is:
U+0130 U+0131 U+0133 U+0141 U+017E U+01C4 U+01C5 U+01C6 U+01FA U+0300 U+0301 U+0307 U+030A U+0323 U+0327 U+0342 U+0398 U+03A1 U+03A9 U+03B1 U+03B8 U+03B9 U+03C9 U+0414 U+0420 U+0434 U+0627 U+0628 U+062A U+0646 U+0647 U+0654 U+08A1 U+0915 U+0921 U+0928 U+092F U+093F U+0942 U+094B U+1100 U+1161 U+1780 U+178A U+178F U+17D2 U+1E9E U+1F23 U+1F7C U+1F93 U+1F9B U+1FB6 U+1FB7 U+1FF2 U+200B U+200C U+200D U+2014 U+2019 U+2044 U+2079 U+2089 U+208A U+20AC U+210C U+210D U+2126 U+212B U+215F U+2189 U+21D2 U+2260 U+2460 U+2469 U+2474 U+2488 U+24B6 U+25CC U+2EF3 U+3002 U+30A2 U+30AB U+30C8 U+30D1 U+30E6 U+30F3 U+30FC U+3250 U+329E U+3300 U+3350 U+3389 U+3392 U+5370 U+9F9F U+AC00 U+1F1F2 U+1F1FF U+1F3F4 U+1F3FB U+1F3FC U+1F3FD U+1F3FE U+1F3FF U+1F467 U+1F468 U+1F469 U+1F46A U+E0062 U+E0063 U+E0067 U+E0073 U+E0074 U+E007F U+FE37 U+FEE9 U+FEEA U+FEEB U+FEEC U+FF21 U+FF5B U+FF76
-->


<title>Character Model for the World Wide Web: String Matching</title>
<link rel="canonical" href="http://www.w3.org/TR/2015/WD-charmod-norm-20151119/"/>
<!-- local styles. Includes the styles from http://www.w3.org/International/docs/styleguide -->
Expand All @@ -11,7 +19,7 @@
var respecConfig = {
// specification status (e.g. WD, LCWD, NOTE, etc.). If in doubt use ED.
specStatus: "ED",
publishDate: "2019-01-19",
publishDate: "2019-01-23",
previousPublishDate: "2015-11-19",
previousMaturity: "WD",

Expand Down
9 changes: 8 additions & 1 deletion local.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
src: url('W3CCharmodNormSubset-Regular.woff2') format('woff2');
}

@font-face {
font-family: Khmer;
font-style: normal;
font-weight: 400;
src: url('NotoSansKhmer-Regular.woff') format('woff');
}

body {
counter-reset: requirement;
}
Expand Down Expand Up @@ -207,7 +214,7 @@ div.exampleBox {

.exampleChar {
font-size: 36pt;
font-family: "NoToFu", "Palatino", "Times", "Times New Roman", "Verdana", serif;
font-family: "Khmer", "NoToFu", "Palatino", "Times", "Times New Roman", "Verdana", serif;
}

.bidiExample {
Expand Down

0 comments on commit 9cbaf56

Please sign in to comment.