diff --git a/src/org/atriasoft/etk/ConfigFont.java b/src/org/atriasoft/etk/ConfigFont.java new file mode 100644 index 0000000..a632aa2 --- /dev/null +++ b/src/org/atriasoft/etk/ConfigFont.java @@ -0,0 +1,75 @@ +package org.atriasoft.etk; + +import java.util.HashMap; +import java.util.Map; + +import org.atriasoft.etk.internal.Log; + +/** @file + * @author Edouard DUPIN + * @copyright 2011, Edouard DUPIN, all right reserved + * @license MPL v2.0 (see license file) + */ + +public class ConfigFont { + private final Map fonts = new HashMap<>(); + private String name = "FreeSans"; + private int size = 12; + + public void add(final String string, final Uri uri) { + this.fonts.put(string, uri); + } + + public Uri getFontUri(final String fontName) { + Uri out = this.fonts.get(fontName); + if (out == null) { + Log.warning(" try to get unexistant font : " + fontName); + } + return out; + } + + /** + * get the current default font name + * @return a reference on the font name string + */ + public String getName() { + return this.name; + } + + /** + * get the default font size. + * @return the font size. + */ + public int getSize() { + return this.size; + } + + /** + * set the defaut font for all the widgets and basics display. + * @param fontName The font name requested (not case sensitive) ex "Arial" or multiple separate by ';' ex : "Arial;Helvetica". + * @param size The default size of the font default=10. + */ + public void set(final String fontName, final int size) { + this.name = fontName; + this.size = size; + Log.debug("Set default Font : '" + this.name + "' size=" + this.size); + } + + /** + * Set the current default font name + * @param fontName The font name requested (not case sensitive) ex "Arial" or multiple separate by ';' ex : "Arial;Helvetica". + */ + public void setName(final String fontName) { + this.name = fontName; + Log.debug("Set default Font : '" + this.name + "' size=" + this.size + " (change name only)"); + } + + /** + * Set the default font size. + * @param size new font size. + */ + public void setSize(final int size) { + this.size = size; + Log.debug("Set default Font : '" + this.name + "' size=" + this.size + " (change size only)"); + } +} diff --git a/src/org/atriasoft/etk/Configs.java b/src/org/atriasoft/etk/Configs.java new file mode 100644 index 0000000..eee0ea5 --- /dev/null +++ b/src/org/atriasoft/etk/Configs.java @@ -0,0 +1,13 @@ +package org.atriasoft.etk; + +public class Configs { + private static ConfigFont fonts = new ConfigFont(); + + public static ConfigFont getConfigFonts() { + return fonts; + } + + private Configs() { + + } +} diff --git a/src/org/atriasoft/etk/math/Vector3f.java b/src/org/atriasoft/etk/math/Vector3f.java index 7458b3b..852d8f9 100644 --- a/src/org/atriasoft/etk/math/Vector3f.java +++ b/src/org/atriasoft/etk/math/Vector3f.java @@ -582,4 +582,11 @@ public record Vector3f( public float triple(final Vector3f obj1, final Vector3f obj2) { return this.x * (obj1.y * obj2.z - obj1.z * obj2.y) + this.y * (obj1.z * obj2.x - obj1.x * obj2.z) + this.z * (obj1.x * obj2.y - obj1.y * obj2.x); } + + public static Vector3f valueOf(final String valuesX, final String valuesY, final String valuesZ) { + float val1 = Float.valueOf(valuesX); + float val2 = Float.valueOf(valuesY); + float val3 = Float.valueOf(valuesZ); + return new Vector3f(val1, val2, val3); + } }