Browse files

Added a simple font override system based on language. fixes #4

  • Loading branch information...
1 parent 278754d commit 1a4bb8cb9cbb0365295c5c677512d01dbe345245 @ingemaradahl ingemaradahl committed May 18, 2012
Showing with 13 additions and 1 deletion.
  1. +3 −1 index.html
  2. +4 −0 resources/emberwind.json
  3. +6 −0 src/ResourceDepot.js
View
4 index.html
@@ -9,9 +9,10 @@
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="icon_72x72.png" />
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="icon_114x114.png" />
- <link href='http://fonts.googleapis.com/css?family=Lobster&subset=latin&v2' rel='stylesheet' type='text/css'/>
+ <link href='http://fonts.googleapis.com/css?family=Lobster&subset=latin,cyrillic' rel='stylesheet' type='text/css'/>
<link href='http://fonts.googleapis.com/css?family=Allan:700&v2' rel='stylesheet' type='text/css'/>
<link href='http://fonts.googleapis.com/css?family=Meddon&v2' rel='stylesheet' type='text/css'/>
+ <link href='http://fonts.googleapis.com/css?family=Cuprum:700italic&subset=latin,cyrillic,latin-ext' rel='stylesheet' type='text/css'>
<script type="text/javascript" src="src/Common.js"></script>
<script type="text/javascript" src="src/Perlin.js"></script>
@@ -131,5 +132,6 @@
<div style="font-family: Lobster; visibility: hidden">one</div>
<div style="font-family: Allan; visibility: hidden">two</div>
<div style="font-family: Meddon; visibility: hidden">three</div>
+<div style="font-family: Cuprum; visibility: hidden">four</div>
</body>
</html>
View
4 resources/emberwind.json
@@ -55532,6 +55532,10 @@
]
},
"resources": {
+ "overrideFonts" : {
+ "russian" : { "Allan" : "Cuprum"},
+ "polish" : { "Allan" : "Cuprum"}
+ },
"fonts": [
{
"outline_b": 0,
View
6 src/ResourceDepot.js
@@ -169,8 +169,14 @@ ResourceDepot.prototype.readResources = function(data) {
this.sfx = obj.sfx;
this.music = obj.music;
+ var overrideFonts = obj.resources.overrideFonts;
for (var i = 0; i < obj.resources.fonts.length; i++) {
var f = obj.resources.fonts[i];
+ if (this.language in overrideFonts) {
+ if (f.font in overrideFonts[this.language]) {
+ f.font = overrideFonts[this.language][f.font];
+ }
+ }
this.fonts[f.id] = new Font(f);
}

0 comments on commit 1a4bb8c

Please sign in to comment.