package com.haxademic.demo.draw.text;

import com.haxademic.core.app.PAppletHax;
import com.haxademic.core.data.constants.PTextAlign;
import com.haxademic.core.draw.text.FontCacher;
import com.haxademic.core.file.FileUtil;

import processing.core.PFont;

public class Demo_FontCacher
extends PAppletHax {
	public static void main(String args[]) { PAppletHax.main(Thread.currentThread().getStackTrace()[1].getClassName()); }

	public void drawApp() {
		background(0);

		String fontFile = "haxademic/fonts/OpenSans-Regular.ttf";
		PFont font = FontCacher.getFont(fontFile, 42);
		FontCacher.setFontOnContext(p.g, font, p.color(255), 1f, PTextAlign.LEFT, PTextAlign.TOP);
		p.text(fontFile, 20, 20);
		
		String fontFile2 = "haxademic/fonts/DSEG7ClassicMini-Regular.ttf";
		font = FontCacher.getFont(fontFile2, 18);
		FontCacher.setFontOnContext(p.g, font, p.color(0, 255, 0), 1.8f, PTextAlign.LEFT, PTextAlign.TOP);
		p.text(fontFile2 + FileUtil.NEWLINE + fontFile2, 20, 100);
	}

}

@@ -175,16 +175,59 @@
 Cacher;%0A
+import com.haxademic.core.file.DemoAssets;%0A
 import c
@@ -259,16 +259,16 @@
 leUtil;%0A
-
 %0Aimport 
@@ -528,33 +528,31 @@
 e = 
-%22haxademic/
+DemoAssets.
 font
-s/
 OpenSans
 -Reg
@@ -547,29 +547,20 @@
 OpenSans
--Regular.ttf%22
+Path
 ;%0A%09%09PFon
@@ -751,54 +751,32 @@
 2 = 
-%22haxademic/
+DemoAssets.
 font
-s/
 DSEG7
-ClassicMini-Regular.ttf%22
+Path
 ;%0A%09%09

Update demo font paths