1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-30 05:19:57 +00:00

Add a parser for woff fonts

It's a bit of a hack to have a parser dedicated to fonts. We'll replace
it with a mechanism that handles generic binary data
This commit is contained in:
Jeremy Ruston 2013-05-01 13:04:27 +01:00
parent b672e12fef
commit 408fcd8aa3
2 changed files with 29 additions and 0 deletions

View File

@ -1235,6 +1235,7 @@ $tw.boot.startup = function() {
$tw.utils.registerFileType("image/png","base64",".png"); $tw.utils.registerFileType("image/png","base64",".png");
$tw.utils.registerFileType("image/gif","base64",".gif"); $tw.utils.registerFileType("image/gif","base64",".gif");
$tw.utils.registerFileType("image/svg+xml","utf8",".svg"); $tw.utils.registerFileType("image/svg+xml","utf8",".svg");
$tw.utils.registerFileType("application/font-woff","base64",".woff");
// Create the wiki store for the app // Create the wiki store for the app
$tw.wiki = new $tw.Wiki(); $tw.wiki = new $tw.Wiki();
// Install built in tiddler fields modules // Install built in tiddler fields modules

View File

@ -0,0 +1,28 @@
/*\
title: $:/core/modules/parsers/fontparser.js
type: application/javascript
module-type: parser
The font parser parses fonts into URI encoded base64
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
var FontParser = function(type,text,options) {
this.tree = [{
type: "element",
tag: "span",
children: [
{type: "text", text: "data:" + type + ";base64," + text}
]
}];
};
exports["application/font-woff"] = FontParser;
})();