Skip to content

Commit 0f88ec1

Browse files
committed
better font support (and change default font)
1 parent 878aa65 commit 0f88ec1

File tree

6 files changed

+8
-9
lines changed

6 files changed

+8
-9
lines changed

haxe/ui/backend/AssetsImpl.hx

+6-5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import nme.display.BitmapData;
1010
import nme.display.Loader;
1111
import nme.events.Event;
1212
import nme.text.Font;
13+
import nme.text.FontStyle;
14+
import nme.text.FontType;
1315
import nme.utils.ByteArray;
1416

1517
class AssetsImpl extends AssetsBase {
@@ -129,15 +131,14 @@ class AssetsImpl extends AssetsBase {
129131
return;
130132
}
131133

132-
var font = Font.loadBytes(ByteArray.fromBytes(bytes));
133-
/* TODO:
134-
Font.registerFont(font);
134+
var font = new Font("", FontStyle.REGULAR, FontType.EMBEDDED, resourceId, resourceId);
135+
var ba = ByteArray.fromBytes(bytes);
136+
var fontData = Font.loadBytes(ba);
137+
Font.registerFontData(font, ba);
135138
var fontInfo = {
136139
data: font.fontName
137140
}
138141
callback(resourceId, fontInfo);
139-
*/
140-
callback(resourceId, null);
141142
}
142143

143144
//***********************************************************************************************************

haxe/ui/backend/nme/_module/styles/default/main.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.label, .textfield, .textarea {
2-
__font-name: "fonts/Roboto-Regular.ttf";
3-
font-name: "_sans";
2+
font-name: "haxeui-nme/styles/fonts/Roboto-Regular.ttf";
3+
__font-name: "_sans";
44
font-size: 13px;
55
}
66

Binary file not shown.
Binary file not shown.
Binary file not shown.

include.nmml

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<project>
3-
<assets path="./assets/styles" rename="styles"/>
4-
<assets path="./assets/fonts" rename="fonts"/>
53
</project>

0 commit comments

Comments
 (0)