Permalink
Browse files

Reinstate embedded fonts (we need them for the rotated text, d'oh) bu…

…t move to a separate SWF so that they will hopefully be cached by the browser
  • Loading branch information...
1 parent d503a1f commit b7fb5dccb0f17ee174e7ec11062ee8b5ba44c301 @systemed committed Jul 16, 2009
Showing with 25 additions and 9 deletions.
  1. +9 −0 fonts/FontLibrary.as
  2. BIN {net/systemeD/halcyon → fonts}/fonts/DejaVuSans-Bold.ttf
  3. BIN {net/systemeD/halcyon → fonts}/fonts/DejaVuSans-BoldOblique.ttf
  4. BIN {net/systemeD/halcyon → fonts}/fonts/DejaVuSans-ExtraLight.ttf
  5. BIN {net/systemeD/halcyon → fonts}/fonts/DejaVuSans-Oblique.ttf
  6. BIN {net/systemeD/halcyon → fonts}/fonts/DejaVuSans.ttf
  7. BIN {net/systemeD/halcyon → fonts}/fonts/DejaVuSansCondensed-Bold.ttf
  8. BIN {net/systemeD/halcyon → fonts}/fonts/DejaVuSansCondensed-BoldOblique.ttf
  9. BIN {net/systemeD/halcyon → fonts}/fonts/DejaVuSansCondensed-Oblique.ttf
  10. BIN {net/systemeD/halcyon → fonts}/fonts/DejaVuSansCondensed.ttf
  11. BIN {net/systemeD/halcyon → fonts}/fonts/DejaVuSansMono-Bold.ttf
  12. BIN {net/systemeD/halcyon → fonts}/fonts/DejaVuSansMono-BoldOblique.ttf
  13. BIN {net/systemeD/halcyon → fonts}/fonts/DejaVuSansMono-Oblique.ttf
  14. BIN {net/systemeD/halcyon → fonts}/fonts/DejaVuSansMono.ttf
  15. BIN {net/systemeD/halcyon → fonts}/fonts/DejaVuSerif-Bold.ttf
  16. BIN {net/systemeD/halcyon → fonts}/fonts/DejaVuSerif-BoldItalic.ttf
  17. BIN {net/systemeD/halcyon → fonts}/fonts/DejaVuSerif-Italic.ttf
  18. BIN {net/systemeD/halcyon → fonts}/fonts/DejaVuSerif.ttf
  19. BIN {net/systemeD/halcyon → fonts}/fonts/DejaVuSerifCondensed-Bold.ttf
  20. BIN {net/systemeD/halcyon → fonts}/fonts/DejaVuSerifCondensed-BoldItalic.ttf
  21. BIN {net/systemeD/halcyon → fonts}/fonts/DejaVuSerifCondensed-Italic.ttf
  22. BIN {net/systemeD/halcyon → fonts}/fonts/DejaVuSerifCondensed.ttf
  23. +1 −1 halcyon_viewer.as
  24. +11 −2 net/systemeD/halcyon/Map.as
  25. +1 −1 net/systemeD/halcyon/POI.as
  26. +1 −3 net/systemeD/halcyon/WayUI.as
  27. +2 −2 net/systemeD/halcyon/styleparser/TextStyle.as
  28. BIN resources/FontLibrary.swf
View
@@ -0,0 +1,9 @@
+package {
+ import flash.display.Sprite;
+ public class FontLibrary extends Sprite {
+ [Embed(source="fonts/DejaVuSans.ttf", fontFamily="DejaVu", fontWeight="normal", mimeType="application/x-font-truetype")]
+ public static var DejaVu:Class;
+
+ }
+
+}
View
@@ -27,7 +27,7 @@ package {
t.multiline=true;
addChild(t);
Globals.vars.debug=t;
- t.visible = true;
+ t.visible = false;
theMap = new Map(this.loaderInfo.parameters);
theMap.updateSize(stage.stageWidth, stage.stageHeight);
@@ -2,11 +2,13 @@ package net.systemeD.halcyon {
import flash.text.TextField;
import flash.display.DisplayObjectContainer;
+ import flash.display.Loader;
import flash.display.Sprite;
import flash.display.Shape;
import flash.display.Stage;
import flash.display.BitmapData;
import flash.display.LoaderInfo;
+ import flash.text.Font;
import flash.utils.ByteArray;
import flash.events.*;
import flash.net.*;
@@ -99,7 +101,6 @@ package net.systemeD.halcyon {
connection.addEventListener(Connection.NEW_WAY, newWayCreated);
connection.addEventListener(Connection.NEW_POI, newPOICreated);
connection.getEnvironment(new Responder(gotEnvironment,connectionError));
-
}
private function getPaintSprite():Sprite {
@@ -109,6 +110,15 @@ package net.systemeD.halcyon {
}
public function gotEnvironment(r:Object):void {
+ var loader:Loader = new Loader();
+ loader.contentLoaderInfo.addEventListener(Event.COMPLETE, gotFont);
+ loader.load(new URLRequest("FontLibrary.swf"));
+ }
+
+ public function gotFont(r:Event):void {
+ var FontLibrary:Class = r.target.applicationDomain.getDefinition("FontLibrary") as Class;
+ Font.registerFont(FontLibrary.DejaVu);
+
if (initparams.hasOwnProperty('lat')) {
// parameters sent from HTML
init(initparams['lat'],
@@ -311,7 +321,6 @@ package net.systemeD.halcyon {
}
public function mouseUpHandler(event:MouseEvent):void {
-addDebug("up");
if (!dragging) { return; }
dragging=false;
updateCoords(x,y);
@@ -18,7 +18,7 @@ package net.systemeD.halcyon {
private var iconname:String=''; // name of icon
public static const DEFAULT_TEXTFIELD_PARAMS:Object = {
- embedFonts: true,
+// embedFonts: true,
antiAliasType: AntiAliasType.ADVANCED,
gridFitType: GridFitType.NONE
};
@@ -29,8 +29,6 @@ package net.systemeD.halcyon {
antiAliasType: AntiAliasType.ADVANCED,
gridFitType: GridFitType.NONE
};
-// [Embed(source="fonts/DejaVuSans.ttf", fontFamily="DejaVu", fontWeight="normal", mimeType="application/x-font-truetype")]
-// public static var DejaVu:Class;
public var nameformat:TextFormat;
@@ -316,10 +314,10 @@ package net.systemeD.halcyon {
private function rotatedLetter(char:String, t:Number, w:Number, h:Number, a:Number, o:Number):TextField {
var tf:TextField = new TextField();
- tf.embedFonts = true;
tf.mouseEnabled = false;
tf.mouseWheelEnabled = false;
tf.defaultTextFormat = nameformat;
+ tf.embedFonts = true;
tf.text = char;
tf.width = tf.textWidth+4;
tf.height = tf.textHeight+4;
@@ -23,7 +23,7 @@ package net.systemeD.halcyon.styleparser {
public var sublayer:uint=0;
public function getTextFormat():TextFormat {
- return new TextFormat(font_name ? font_name : "_sans",
+ return new TextFormat(font_name ? font_name : "DejaVu",
text_size ? text_size : 8,
text_colour ? text_colour: 0,
font_bold ? font_bold : false,
@@ -41,7 +41,7 @@ package net.systemeD.halcyon.styleparser {
var tf:TextField = new TextField();
var n:TextFormat = getTextFormat();
n.align = "center";
-// tf.embedFonts = true;
+ tf.embedFonts = true;
tf.defaultTextFormat = n;
tf.text = a;
if (text_width) {
View
Binary file not shown.

0 comments on commit b7fb5dc

Please sign in to comment.