diff --git a/resources/resources/ewol/theme/color/Label.json b/resources/resources/ewol/theme/color/Label.json
index 14d16d3..fa813f0 100644
--- a/resources/resources/ewol/theme/color/Label.json
+++ b/resources/resources/ewol/theme/color/Label.json
@@ -1,6 +1,6 @@
{
"color": [
{ name:"background", color:"#0000" },
- { name:"foreground", color:"#FFFF" }
+ { name:"foreground", color:"#000F" }
]
}
diff --git a/samples/src/sample/atriasoft/ewol/BasicWindows.java b/samples/src/sample/atriasoft/ewol/BasicWindows.java
index 37d62b1..a4c9cb0 100644
--- a/samples/src/sample/atriasoft/ewol/BasicWindows.java
+++ b/samples/src/sample/atriasoft/ewol/BasicWindows.java
@@ -116,9 +116,8 @@ public class BasicWindows extends Windows {
simpleSpacer.setPropertyMinSize(new Dimension3f(new Vector3f(30, 30, 30), Distance.PIXEL));
this.sizerMenuHori.subWidgetAdd(simpleSpacer);
}
- /*
{
- this.buttonExpandX = Button.createLabelButton("un-expand X");
+ this.buttonExpandX = Button.createToggleLabelButton("un-expand X", "expand X");
this.buttonExpandX.setPropertyExpand(Vector3b.FALSE);
this.buttonExpandX.setPropertyFill(Vector3b.FALSE);
this.buttonExpandX.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL));
@@ -126,7 +125,7 @@ public class BasicWindows extends Windows {
this.buttonExpandX.signalClick.connectAuto(this, BasicWindows::eventButtonExpandX);
}
{
- this.buttonExpandY = Button.createLabelButton("un-expand Y");
+ this.buttonExpandY = Button.createToggleLabelButton("un-expand Y", "expand Y");
this.buttonExpandY.setPropertyExpand(Vector3b.FALSE);
this.buttonExpandY.setPropertyFill(Vector3b.FALSE);
this.buttonExpandY.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL));
@@ -134,7 +133,7 @@ public class BasicWindows extends Windows {
this.buttonExpandY.signalClick.connectAuto(this, BasicWindows::eventButtonExpandY);
}
{
- this.buttonFillX = Button.createLabelButton("un-fill X");
+ this.buttonFillX = Button.createToggleLabelButton("un-fill X", "fill X");
this.buttonFillX.setPropertyExpand(Vector3b.FALSE);
this.buttonFillX.setPropertyFill(Vector3b.FALSE);
this.buttonFillX.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL));
@@ -142,7 +141,7 @@ public class BasicWindows extends Windows {
this.buttonFillX.signalClick.connectAuto(this, BasicWindows::eventButtonFillX);
}
{
- this.buttonFillY = Button.createLabelButton("un-fill Y");
+ this.buttonFillY = Button.createToggleLabelButton("un-fill Y", "fill Y");
this.buttonFillY.setPropertyExpand(Vector3b.FALSE);
this.buttonFillY.setPropertyFill(Vector3b.FALSE);
this.buttonFillY.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL));
@@ -157,7 +156,6 @@ public class BasicWindows extends Windows {
this.sizerMenuHori.subWidgetAdd(this.buttonGravity);
this.buttonGravity.signalClick.connectAuto(this, BasicWindows::eventButtonChangeGravity);
}
- */
}
public void addButton(Widget widget) {
diff --git a/samples/src/sample/atriasoft/ewol/sampleButton/MainWindows.java b/samples/src/sample/atriasoft/ewol/sampleButton/MainWindows.java
index f3fc62d..ea646de 100644
--- a/samples/src/sample/atriasoft/ewol/sampleButton/MainWindows.java
+++ b/samples/src/sample/atriasoft/ewol/sampleButton/MainWindows.java
@@ -9,8 +9,7 @@ public class MainWindows extends BasicWindows {
public MainWindows() {
setPropertyTitle("Simple Button test");
-
- Button simpleButton = Button.createLabelButton("Top Button");
+ Button simpleButton = Button.createLabelButton("My button internal label");
simpleButton.setPropertyExpand(Vector3b.TRUE);
simpleButton.setPropertyFill(Vector3b.TRUE);
this.setTestWidget(simpleButton);
diff --git a/samples/src/sample/atriasoft/ewol/simpleWindowsLabel/MainWindows.java b/samples/src/sample/atriasoft/ewol/simpleWindowsLabel/MainWindows.java
index 4b2089f..02fc42e 100644
--- a/samples/src/sample/atriasoft/ewol/simpleWindowsLabel/MainWindows.java
+++ b/samples/src/sample/atriasoft/ewol/simpleWindowsLabel/MainWindows.java
@@ -15,15 +15,14 @@ public class MainWindows extends BasicWindows {
//! [ewol_sample_HW_windows_label]
if (true) {
//! [ewol_sample_HW_windows_title]
- Label simpleLabel = new Label();
- simpleLabel.setPropertyValue(
- "Hello. World
- Coucou comment ca vas ???
- Pas trop bien, je me suis cassé la jambe.
The end");
+ final Label simpleLabel = new Label();
+ simpleLabel.setPropertyValue("Hello. World
- How are You ???
- Not so Well, I break my leg.
The end");
simpleLabel.setPropertyExpand(Vector3b.TRUE);
simpleLabel.setPropertyFill(Vector3b.TRUE);
this.setTestWidget(simpleLabel);
//! [ewol_sample_HW_windows_label]
} else {
- Spacer simpleSpacer = new Spacer();
+ final Spacer simpleSpacer = new Spacer();
simpleSpacer.setPropertyExpand(Vector3b.TRUE);
simpleSpacer.setPropertyFill(Vector3b.TRUE);
this.setTestWidget(simpleSpacer);
diff --git a/samples/src/sample/atriasoft/ewol/simpleWindowsWithImage/MainWindows.java b/samples/src/sample/atriasoft/ewol/simpleWindowsWithImage/MainWindows.java
index c03941b..024d2a0 100644
--- a/samples/src/sample/atriasoft/ewol/simpleWindowsWithImage/MainWindows.java
+++ b/samples/src/sample/atriasoft/ewol/simpleWindowsWithImage/MainWindows.java
@@ -17,9 +17,9 @@ public class MainWindows extends BasicWindows {
}
public static void eventButtonChangeKeepRatio(final MainWindows self) {
- boolean state = self.testWidget.isPropertyKeepRatio();
+ final boolean state = self.testWidget.isPropertyKeepRatio();
self.testWidget.setPropertyKeepRatio(!state);
- self.buttonAspectRatio.setPropertyValue(state ? "fkeep aspect ratio" : "un-keep aspect ratio");
+ //self.buttonAspectRatio.setPropertyValue(state ? "fkeep aspect ratio" : "un-keep aspect ratio");
}
ImageDisplay testWidget;
@@ -36,7 +36,7 @@ public class MainWindows extends BasicWindows {
this.testWidget.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL));
this.setTestWidget(this.testWidget);
{
- Button button = Button.createLabelButton("Change image");
+ final Button button = Button.createLabelButton("Change image");
button.setPropertyExpand(Vector3b.FALSE);
button.setPropertyFill(Vector3b.FALSE);
button.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL));
diff --git a/src/org/atriasoft/ewol/compositing/CompositingText.java b/src/org/atriasoft/ewol/compositing/CompositingText.java
index 7b42c0e..e1d0296 100644
--- a/src/org/atriasoft/ewol/compositing/CompositingText.java
+++ b/src/org/atriasoft/ewol/compositing/CompositingText.java
@@ -29,18 +29,22 @@ public class CompositingText extends TextBase {
protected List texturePositions = new ArrayList<>();
+ protected String currentFontName = "";
+ protected int currentFontSize = -2; // -1 is to perform first initialization
+ protected int currentFontSizeRequired = -2; // -1 is to perform first initialization
+
public CompositingText() {
this("");
}
public CompositingText(final String fontName) {
- this(fontName, -1);
+ this(fontName, 0);
}
/**
* generic constructor
* @param fontName Name of the font that might be loaded
- * @param fontSize size of the font that might be loaded
+ * @param fontSize Size of the font that might be loaded
*/
public CompositingText(final String fontName, final int fontSize) {
setFont(fontName, fontSize);
@@ -48,6 +52,7 @@ public class CompositingText extends TextBase {
@Override
public Vector3f calculateSizeChar(final Character charcode) {
+ final float renderRatio = (float) this.currentFontSize / (float) this.currentFontSizeRequired;
// get a pointer on the glyph property :
final GlyphProperty myGlyphProperty = getGlyphPointer(charcode);
final int fontHeigh = (int) getHeight();
@@ -57,15 +62,15 @@ public class CompositingText extends TextBase {
} else {
Log.warning("no Glyph... in font : " + this.font.getName());
}
- return new Vector3f((float) (0.2), (fontHeigh), (float) (0.0));
+ return new Vector3f(0.2f, fontHeigh, 0);
}
- // get the kerning ofset :
- float kerningOffset = 0.0f;
+ // get the kerning offset :
+ float kerningOffset = 0;
if (this.kerning) {
kerningOffset = myGlyphProperty.kerningGet(this.previousCharcode);
}
- final Vector3f outputSize = new Vector3f(myGlyphProperty.getAdvenceX() + kerningOffset, (fontHeigh), 0.0f);
+ final Vector3f outputSize = new Vector3f((myGlyphProperty.getAdvenceX() + kerningOffset) * renderRatio, (fontHeigh), 0);
// Register the previous character
this.previousCharcode = charcode;
return outputSize;
@@ -186,7 +191,8 @@ public class CompositingText extends TextBase {
Log.warning("no font...");
return 10.0f;
}
- return this.font.getHeight(this.mode);
+ final float renderRatio = (float) this.currentFontSize / (float) this.currentFontSizeRequired;
+ return this.font.getHeight(this.mode) * renderRatio;
}
@Override
@@ -195,7 +201,8 @@ public class CompositingText extends TextBase {
Log.warning("no font...");
return 1.0f;
}
- return this.font.getFontSize();
+ final float renderRatio = (float) this.currentFontSize / (float) this.currentFontSizeRequired;
+ return this.font.getFontSize() * renderRatio;
}
@Override
@@ -206,13 +213,16 @@ public class CompositingText extends TextBase {
Log.error(" font does not really existed ...");
return;
}
- final int fontSize = (int) getSize();
- final int fontHeigh = (int) getHeight();
+ // sometime we do net require the correct size to the glyph renderer (due to the fact SVG render is not clear on lower size...)
+ final float renderRatio = (float) this.currentFontSize / (float) this.currentFontSizeRequired;
- // get the kerning ofset :
+ final int fontSize = (int) (getSize() * renderRatio);
+ final int fontHeigh = (int) (getHeight() * renderRatio);
+
+ // get the kerning offset :
float kerningOffset = 0;
if (this.kerning) {
- kerningOffset = myGlyphProperty.kerningGet(this.previousCharcode);
+ kerningOffset = myGlyphProperty.kerningGet(this.previousCharcode) * renderRatio;
if (kerningOffset != 0) {
// Log.debug("Kerning between : '" + this.previousCharcode + "''" + myGlyph.UVal
// + "' value : " + kerningOffset);
@@ -223,10 +233,10 @@ public class CompositingText extends TextBase {
/*
* Bitmap position xA xB yC *------* | | | | yD *------*
*/
- float dxA = this.position.x() + myGlyphProperty.getTextureRenderOffset().x() + kerningOffset;
- float dxB = dxA + myGlyphProperty.sizeTexture.x();
- float dyC = this.position.y() + myGlyphProperty.getTextureRenderOffset().y() + fontHeigh - fontSize;
- float dyD = dyC - myGlyphProperty.sizeTexture.y();
+ float dxA = this.position.x() + myGlyphProperty.getTextureRenderOffset().x() * renderRatio + kerningOffset;
+ float dxB = dxA + myGlyphProperty.sizeTexture.x() * renderRatio;
+ float dyC = this.position.y() + myGlyphProperty.getTextureRenderOffset().y() * renderRatio + fontHeigh - fontSize;
+ float dyD = dyC - myGlyphProperty.sizeTexture.y() * renderRatio;
float tuA = myGlyphProperty.texturePosStart.x();
float tuB = tuA + myGlyphProperty.texturePosSize.x();
@@ -301,7 +311,7 @@ public class CompositingText extends TextBase {
* Step 1 : ******** ****** **** **
*
*/
- // set texture coordonates :
+ // set texture coordinates :
this.texturePositions.add(texturePos0);
this.texturePositions.add(texturePos1);
this.texturePositions.add(texturePos2);
@@ -318,7 +328,7 @@ public class CompositingText extends TextBase {
*
* ** **** ****** ********
*/
- // set texture coordonates :
+ // set texture coordinates :
this.texturePositions.add(texturePos0);
this.texturePositions.add(texturePos2);
this.texturePositions.add(texturePos3);
@@ -336,7 +346,7 @@ public class CompositingText extends TextBase {
// move the position :
// Log.debug(" 5 pos=" + this.position + " advance=" + myGlyph.advance.x() + "
// kerningOffset=" + kerningOffset);
- this.position = this.position.withX(this.position.x() + myGlyphProperty.getAdvenceX() + kerningOffset);
+ this.position = this.position.withX(this.position.x() + myGlyphProperty.getAdvenceX() * renderRatio + kerningOffset);
// Log.debug(" 6 print '" + char-code + "' : start=" + this.sizeDisplayStart + "
// stop=" + this.sizeDisplayStop + " pos=" + this.position);
// Register the previous character
@@ -345,8 +355,13 @@ public class CompositingText extends TextBase {
}
@Override
- public void setFont(String fontName, int fontSize) {
- clear();
+ public void setFont(final String inputFontName, final int inputFontSize) {
+ if (inputFontName.equals(this.currentFontName) && inputFontSize == this.currentFontSize) {
+ return;
+ }
+
+ String fontName = inputFontName;
+ int fontSize = inputFontSize;
// remove old one
final ResourceTexturedFont previousFont = this.font;
if (fontSize <= 0) {
@@ -355,14 +370,30 @@ public class CompositingText extends TextBase {
if (fontName.isEmpty()) {
fontName = Configs.getConfigFonts().getName();
}
- Uri fontUri = Configs.getConfigFonts().getFontUri(fontName).clone();
- fontUri.setProperty("size", Integer.toString(fontSize));
- Log.verbose("plop : " + fontName + " size=" + fontSize + " result :" + fontName);
+
+ // if size in under 25, we request upper size:
+ int sizeRequest = 25;
+ if (fontSize > 25) {
+ sizeRequest = fontSize;
+ }
+ if (inputFontName.equals(this.currentFontName) && this.currentFontSizeRequired == sizeRequest) {
+ this.currentFontSize = inputFontSize;
+ return;
+ }
+
+ clear();
+ final Uri fontUri = Configs.getConfigFonts().getFontUri(fontName).clone();
+ fontUri.setProperty("size", Integer.toString(sizeRequest));
+ Log.verbose("plop : " + fontName + " size=" + sizeRequest + " result :" + fontName);
// link to new one
this.font = ResourceTexturedFont.create(fontUri);
if (this.font == null) {
Log.error("Can not get font resource");
this.font = previousFont;
+ } else {
+ this.currentFontName = inputFontName;
+ this.currentFontSize = inputFontSize;
+ this.currentFontSizeRequired = sizeRequest;
}
}
@@ -375,25 +406,12 @@ public class CompositingText extends TextBase {
@Override
public void setFontName(final String fontName) {
- // get old size
- int fontSize = -1;
- if (this.font != null) {
- fontSize = this.font.getFontSize();
- }
- setFont(fontName, fontSize);
+ setFont(fontName, this.currentFontSize);
}
@Override
public void setFontSize(final int fontSize) {
- // get old size
- String fontName = "";
- if (this.font != null) {
- fontName = this.font.getName();
- // Remove the :XX for the size ...
- final int pos = fontName.lastIndexOf(':');
- fontName = fontName.substring(0, pos);
- }
- setFont(fontName, fontSize);
+ setFont(this.currentFontName, fontSize);
}
}
diff --git a/src/org/atriasoft/ewol/context/EwolContext.java b/src/org/atriasoft/ewol/context/EwolContext.java
index 72a94b9..8801118 100644
--- a/src/org/atriasoft/ewol/context/EwolContext.java
+++ b/src/org/atriasoft/ewol/context/EwolContext.java
@@ -29,17 +29,16 @@ import org.atriasoft.gale.key.KeyStatus;
import org.atriasoft.gale.key.KeyType;
import org.atriasoft.gale.resource.ResourceManager;
-// Here we hereted from the gale application to be agnostic of the OW where we work ...
+// Here we herited from the gale application to be agnostic of the OW where we work ...
public class EwolContext extends GaleApplication {
/**
- * From everyware in the program, we can get the context inteface.
+ * From everywhere in the program, we can get the context inteface.
* @return current reference on the instance.
*/
- @SuppressWarnings("preview")
public static EwolContext getContext() {
- GaleApplication appl = Gale.getContext().getApplication();
- if (appl instanceof EwolContext elem) {
+ final GaleApplication appl = Gale.getContext().getApplication();
+ if (appl instanceof final EwolContext elem) {
return elem;
}
return null;
@@ -47,10 +46,6 @@ public class EwolContext extends GaleApplication {
private EwolApplication application; // !< Application handle
- private final int initStepId = 0;
-
- private final int initTotalStep = 0;
-
private final InputManager input;
private final ObjectManager objectManager; // !< Object Manager main instance
diff --git a/src/org/atriasoft/ewol/internal/Log.java b/src/org/atriasoft/ewol/internal/Log.java
index 86b76e8..a1b917e 100644
--- a/src/org/atriasoft/ewol/internal/Log.java
+++ b/src/org/atriasoft/ewol/internal/Log.java
@@ -16,51 +16,58 @@ public class Log {
private static final boolean PRINT_VERBOSE = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.VERBOSE);
private static final boolean PRINT_WARNING = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.WARNING);
- public static void critical(final String data) {
- if (Log.PRINT_CRITICAL || Log.FORCE_ALL) {
- Logger.critical(Log.LIB_NAME_DRAW, data);
+ public static void critical(final Exception e, final String data) {
+ e.printStackTrace();
+ if (PRINT_CRITICAL || FORCE_ALL) {
+ Logger.critical(LIB_NAME_DRAW, data + " : " + e.getMessage());
}
}
- public static void debug(final String data) {
- if (Log.PRINT_DEBUG || Log.FORCE_ALL) {
- Logger.debug(Log.LIB_NAME_DRAW, data);
+ public static void critical(final String data, final Object... objects) {
+ if (PRINT_CRITICAL || FORCE_ALL) {
+ Logger.critical(LIB_NAME_DRAW, data, objects);
}
}
- public static void error(final String data) {
- if (Log.PRINT_ERROR || Log.FORCE_ALL) {
- Logger.error(Log.LIB_NAME_DRAW, data);
+ public static void debug(final String data, final Object... objects) {
+ if (PRINT_DEBUG || FORCE_ALL) {
+ Logger.debug(LIB_NAME_DRAW, data, objects);
}
}
- public static void info(final String data) {
- if (Log.PRINT_INFO || Log.FORCE_ALL) {
- Logger.info(Log.LIB_NAME_DRAW, data);
+ public static void error(final String data, final Object... objects) {
+ if (PRINT_ERROR || FORCE_ALL) {
+ Logger.error(LIB_NAME_DRAW, data, objects);
}
}
- public static void print(final String data) {
- if (Log.PRINT_PRINT || Log.FORCE_ALL) {
- Logger.print(Log.LIB_NAME_DRAW, data);
+ public static void info(final String data, final Object... objects) {
+ if (PRINT_INFO || FORCE_ALL) {
+ Logger.info(LIB_NAME_DRAW, data, objects);
}
}
- public static void todo(final String data) {
- if (Log.PRINT_TODO || Log.FORCE_ALL) {
- Logger.todo(Log.LIB_NAME_DRAW, data);
+ public static void print(final String data, final Object... objects) {
+ if (PRINT_PRINT || FORCE_ALL) {
+ Logger.print(LIB_NAME_DRAW, data, objects);
}
}
- public static void verbose(final String data) {
- if (Log.PRINT_VERBOSE || Log.FORCE_ALL) {
- Logger.verbose(Log.LIB_NAME_DRAW, data);
+ public static void todo(final String data, final Object... objects) {
+ if (PRINT_TODO || FORCE_ALL) {
+ Logger.todo(LIB_NAME_DRAW, data, objects);
}
}
- public static void warning(final String data) {
- if (Log.PRINT_WARNING || Log.FORCE_ALL) {
- Logger.warning(Log.LIB_NAME_DRAW, data);
+ public static void verbose(final String data, final Object... objects) {
+ if (PRINT_VERBOSE || FORCE_ALL) {
+ Logger.verbose(LIB_NAME_DRAW, data, objects);
+ }
+ }
+
+ public static void warning(final String data, final Object... objects) {
+ if (PRINT_WARNING || FORCE_ALL) {
+ Logger.warning(LIB_NAME_DRAW, data, objects);
}
}
diff --git a/src/org/atriasoft/ewol/resource/ResourceFontSvg.java b/src/org/atriasoft/ewol/resource/ResourceFontSvg.java
index 811c07d..4a63746 100644
--- a/src/org/atriasoft/ewol/resource/ResourceFontSvg.java
+++ b/src/org/atriasoft/ewol/resource/ResourceFontSvg.java
@@ -55,8 +55,7 @@ public class ResourceFontSvg extends Resource {
@Override
public void cleanUp() {
- // TODO Auto-generated method stub
-
+ // nothing to do...
}
public synchronized void display() {
@@ -64,7 +63,7 @@ public class ResourceFontSvg extends Resource {
}
public synchronized boolean drawGlyph(final ImageByte imageOut, final int fontSize, final Vector2i glyphPosition, final GlyphProperty property, final int posInImage) {
- Weight weight = this.font.render(property.glyph.getUnicodeValue(), fontSize);
+ final Weight weight = this.font.render(property.glyph.getUnicodeValue(), fontSize);
if (weight == null) {
return false;
}
@@ -93,7 +92,7 @@ public class ResourceFontSvg extends Resource {
}
public synchronized boolean drawGlyph(final ImageByteMono imageOut, final int fontSize, final GlyphProperty property, final int borderSize) {
- Weight weight = this.font.render(property.glyph.getUnicodeValue(), fontSize);
+ final Weight weight = this.font.render(property.glyph.getUnicodeValue(), fontSize);
for (int jjj = 0; jjj < weight.getHeight(); jjj++) {
for (int iii = 0; iii < weight.getWidth(); iii++) {
final float valueColor = weight.get(iii, weight.getHeight() - 1 - jjj);
@@ -105,7 +104,7 @@ public class ResourceFontSvg extends Resource {
}
public synchronized GlyphProperty getGlyphProperty(final int fontSize, final int uicodeVal) {
- Glyph glyph = this.font.getGlyphNullIfMissing(uicodeVal);
+ final Glyph glyph = this.font.getGlyphNullIfMissing(uicodeVal);
GlyphProperty out;
if (glyph == null) {
out = new GlyphProperty(this.font, uicodeVal, fontSize);
@@ -120,8 +119,8 @@ public class ResourceFontSvg extends Resource {
}
public synchronized Vector2f getSize(final int fontSize, final String unicodeString) {
- float width = this.font.calculateWidth(unicodeString, fontSize, false);
- float height = this.font.calculateFontRealHeight(fontSize);
+ final float width = this.font.calculateWidth(unicodeString, fontSize, false);
+ final float height = this.font.calculateFontRealHeight(fontSize);
return new Vector2f(width, height);
}
diff --git a/src/org/atriasoft/ewol/resource/ResourceTexturedFont.java b/src/org/atriasoft/ewol/resource/ResourceTexturedFont.java
index 54d19e4..ddbd04c 100644
--- a/src/org/atriasoft/ewol/resource/ResourceTexturedFont.java
+++ b/src/org/atriasoft/ewol/resource/ResourceTexturedFont.java
@@ -46,13 +46,13 @@ public class ResourceTexturedFont extends ResourceTexture2 {
private final Uri[] fileName = new Uri[4];
// specific element to have the the know if the specify element is known...
// == > otherwise I can just generate italic ...
- // == > Bold is a little more complicated (maybe with the bordersize)
+ // == > Bold is a little more complicated (maybe with the border-size)
private final ResourceFontSvg[] font = new ResourceFontSvg[4];
private final int[] height = new int[4];
// for the texture generation :
public Vector2i[] lastGlyphPos = new Vector2i[4];
public int[] lastRawHeigh = new int[4];
- public List[] listElement = new ArrayList[4];// = new (List)[4];
+ public List[] listElement = new ArrayList[4];
private final FontMode[] modeWraping = new FontMode[4]; // !< This is a wrapping mode to prevent the fact that no
private int size = 10;
@@ -87,16 +87,16 @@ public class ResourceTexturedFont extends ResourceTexture2 {
this.listElement[2] = new ArrayList<>();
this.listElement[3] = new ArrayList<>();
- String sizeString = fontBaseUri.getProperty("size");
+ final String sizeString = fontBaseUri.getProperty("size");
if (sizeString == null) {
this.size = 25;
} else {
this.size = Integer.parseInt(sizeString);
}
// find all the fonts...
- Uri fontBaseUriBold = new Uri(fontBaseUri.getGroup(), fontBaseUri.getPath().replace(".svg", "Bold.svg"), fontBaseUri.getproperties());
- Uri fontBaseUriOblique = new Uri(fontBaseUri.getGroup(), fontBaseUri.getPath().replace(".svg", "Oblique.svg"), fontBaseUri.getproperties());
- Uri fontBaseUriBoldOblique = new Uri(fontBaseUri.getGroup(), fontBaseUri.getPath().replace(".svg", "BoldOblique.svg"), fontBaseUri.getproperties());
+ final Uri fontBaseUriBold = new Uri(fontBaseUri.getGroup(), fontBaseUri.getPath().replace(".svg", "Bold.svg"), fontBaseUri.getproperties());
+ final Uri fontBaseUriOblique = new Uri(fontBaseUri.getGroup(), fontBaseUri.getPath().replace(".svg", "Oblique.svg"), fontBaseUri.getproperties());
+ final Uri fontBaseUriBoldOblique = new Uri(fontBaseUri.getGroup(), fontBaseUri.getPath().replace(".svg", "BoldOblique.svg"), fontBaseUri.getproperties());
if (fontBaseUri.exist()) {
this.fileName[FontMode.REGULAR.getValue()] = fontBaseUri;
}
@@ -140,7 +140,7 @@ public class ResourceTexturedFont extends ResourceTexture2 {
}
}
for (int iiiFontId = 0; iiiFontId < 4; iiiFontId++) {
- // set the bassic charset:
+ // set the basic char-set:
this.listElement[iiiFontId].clear();
if (this.font[iiiFontId] == null) {
continue;
@@ -190,7 +190,7 @@ public class ResourceTexturedFont extends ResourceTexture2 {
this.lastGlyphPos[iii] = new Vector2i(1, this.lastGlyphPos[iii].y() + this.lastRawHeigh[iii]);
this.lastRawHeigh[iii] = 0;
}
- Log.error("glyph texture size = " + tmpchar.sizeTexture + "last posY=" + this.lastGlyphPos[iii].y() + " out size=" + this.data.getSize());
+ Log.verbose("glyph texture size = " + tmpchar.sizeTexture + "last posY=" + this.lastGlyphPos[iii].y() + " out size=" + this.data.getSize());
while (this.lastGlyphPos[iii].y() + tmpchar.sizeTexture.y() + 3 > this.data.getSize().y()) {
this.data.resize(this.data.getSize().x(), this.data.getSize().y() * 2);
// note : need to rework all the layer due to the fact that the texture is used by the 4 type...
@@ -238,9 +238,9 @@ public class ResourceTexturedFont extends ResourceTexture2 {
}
/**
- * get the pointer on the coresponding glyph
+ * get the pointer on the corresponding glyph
* @param charcode The unicodeValue
- * @param displayMode Mode to display the currrent font
+ * @param displayMode Mode to display the current font
* @return The pointer on the glyph == > never null
*/
public synchronized GlyphProperty getGlyph(final Character charcode, final FontMode displayMode) {
@@ -265,8 +265,8 @@ public class ResourceTexturedFont extends ResourceTexture2 {
/**
* get the display height of this font
- * @param DisplayMode Mode to display the currrent font
- * @return Dimention of the font need between 2 lines
+ * @param DisplayMode Mode to display the current font
+ * @return Dimension of the font need between 2 lines
*/
public int getHeight() {
return this.height[FontMode.REGULAR.getValue()];
@@ -279,7 +279,7 @@ public class ResourceTexturedFont extends ResourceTexture2 {
/**
* get the ID of a unicode charcode
* @param charcode The unicodeValue
- * @param displayMode Mode to display the currrent font
+ * @param displayMode Mode to display the current font
* @return The ID in the table (if it does not exist : return 0)
*/
private synchronized int getIndex(final Character charcode, final FontMode displayMode) {
diff --git a/src/org/atriasoft/ewol/widget/Button.java b/src/org/atriasoft/ewol/widget/Button.java
index fb9f1aa..1e2ef3d 100644
--- a/src/org/atriasoft/ewol/widget/Button.java
+++ b/src/org/atriasoft/ewol/widget/Button.java
@@ -44,6 +44,7 @@ public class Button extends ContainerToggle {
public static Button createLabelButton(final String label) {
final Button out = new Button();
final Label labelWidget = new Label();
+ labelWidget.setPropertyFontSize(12);
labelWidget.setPropertyFill(Vector3b.FALSE);
labelWidget.setPropertyExpand(Vector3b.FALSE);
labelWidget.setPropertyGravity(Gravity.CENTER);
@@ -52,6 +53,28 @@ public class Button extends ContainerToggle {
return out;
}
+ public static Button createToggleLabelButton(final String label0, final String label1) {
+ final Button out = new Button();
+ {
+ final Label labelWidget = new Label();
+ labelWidget.setPropertyFill(Vector3b.FALSE);
+ labelWidget.setPropertyExpand(Vector3b.FALSE);
+ labelWidget.setPropertyGravity(Gravity.CENTER);
+ labelWidget.setPropertyValue(label0);
+ out.setSubWidget(labelWidget, 0);
+ }
+ {
+ final Label labelWidget = new Label();
+ labelWidget.setPropertyFill(Vector3b.FALSE);
+ labelWidget.setPropertyExpand(Vector3b.FALSE);
+ labelWidget.setPropertyGravity(Gravity.CENTER);
+ labelWidget.setPropertyValue(label1);
+ out.setSubWidget(labelWidget, 1);
+ }
+ out.setPropertyToggleMode(true);
+ return out;
+ }
+
/**
* Periodic call to update grapgic display
* @param event Time generic event
@@ -318,6 +341,9 @@ public class Button extends ContainerToggle {
if (KeyStatus.pressSingle == event.status() && over) {
keepFocus();
this.signalClick.emit();
+ if (this.propertyToggleMode) {
+ this.setPropertyValue(!this.propertyValue);
+ }
return true;
}
if (KeyStatus.down == event.status() && over) {
diff --git a/src/org/atriasoft/ewol/widget/ContainerToggle.java b/src/org/atriasoft/ewol/widget/ContainerToggle.java
index f898da4..79c61f0 100644
--- a/src/org/atriasoft/ewol/widget/ContainerToggle.java
+++ b/src/org/atriasoft/ewol/widget/ContainerToggle.java
@@ -22,7 +22,10 @@ public class ContainerToggle extends Widget {
/**
* Constructor
*/
- public ContainerToggle() {}
+ public ContainerToggle() {
+ this.subWidget[0] = null;
+ this.subWidget[1] = null;
+ }
// @Override
// public boolean loadXML(final XmlElement node) {
diff --git a/src/org/atriasoft/ewol/widget/Label.java b/src/org/atriasoft/ewol/widget/LabelOnSVG.java
similarity index 98%
rename from src/org/atriasoft/ewol/widget/Label.java
rename to src/org/atriasoft/ewol/widget/LabelOnSVG.java
index 1d00e5d..2cb4122 100644
--- a/src/org/atriasoft/ewol/widget/Label.java
+++ b/src/org/atriasoft/ewol/widget/LabelOnSVG.java
@@ -23,7 +23,7 @@ import org.atriasoft.exml.annotation.XmlManaged;
import org.atriasoft.exml.annotation.XmlName;
import org.atriasoft.gale.key.KeyStatus;
-public class Label extends Widget {
+public class LabelOnSVG extends Widget {
protected int colorDefaultBgText = -1; //!< Default Background color of the text
protected int colorDefaultFgText = -1; //!< Default color of the text
protected ResourceColorFile colorProperty; //!< theme color property
@@ -37,7 +37,7 @@ public class Label extends Widget {
protected CompositingText text = new CompositingText(); //!< Compositing text element.
protected String value = "";
- public Label() {
+ public LabelOnSVG() {
this.colorProperty = ResourceColorFile.create(new Uri("THEME", "/color/Label.json", "ewol"));
if (this.colorProperty != null) {
this.colorDefaultFgText = this.colorProperty.request("foreground");
@@ -51,7 +51,7 @@ public class Label extends Widget {
* Constructor
* @param newLabel The displayed decorated text.
*/
- public Label(final String newLabel) {
+ public LabelOnSVG(final String newLabel) {
this.colorProperty = ResourceColorFile.create(new Uri("THEME", "/color/Label.json", "ewol"));
if (this.colorProperty != null) {
this.colorDefaultFgText = this.colorProperty.request("foreground");
diff --git a/src/org/atriasoft/ewol/widget/WidgetXmlFactory.java b/src/org/atriasoft/ewol/widget/WidgetXmlFactory.java
index eabf050..3f7ac5e 100644
--- a/src/org/atriasoft/ewol/widget/WidgetXmlFactory.java
+++ b/src/org/atriasoft/ewol/widget/WidgetXmlFactory.java
@@ -10,7 +10,7 @@ public class WidgetXmlFactory implements InterfaceXmlFactoryAccess {
static {
listWidgetAvaillable.put("Button", Button.class);
listWidgetAvaillable.put("Sizer", Sizer.class);
- listWidgetAvaillable.put("Label", Label.class);
+ listWidgetAvaillable.put("Label", LabelOnSVG.class);
listWidgetAvaillable.put("CheckBox", CheckBox.class);
listWidgetAvaillable.put("Image", ImageDisplay.class);
}