mirror of
https://github.com/processing/processing4.git
synced 2026-02-02 21:29:17 +01:00
mostly font work, making multibyte fonts happen
This commit is contained in:
@@ -4193,11 +4193,11 @@ public class PGraphics extends PImage
|
||||
}
|
||||
text_font = which;
|
||||
if (text_space != SCREEN_SPACE) {
|
||||
text_font.size();
|
||||
text_font.resetSize();
|
||||
} else {
|
||||
text_font.size(text_font.iwidth);
|
||||
}
|
||||
text_font.leading();
|
||||
text_font.resetLeading();
|
||||
}
|
||||
|
||||
public void textFont(PFont which, float size) {
|
||||
@@ -4212,7 +4212,7 @@ public class PGraphics extends PImage
|
||||
System.err.println("Cannot set size of SCREEN_SPACE fonts");
|
||||
text_font.size(text_font.iwidth);
|
||||
}
|
||||
text_font.leading();
|
||||
text_font.resetLeading();
|
||||
}
|
||||
|
||||
public void textSize(float size) {
|
||||
@@ -4244,7 +4244,7 @@ public class PGraphics extends PImage
|
||||
|
||||
if ((space == SCREEN_SPACE) && (text_font != null)) {
|
||||
text_font.size(text_font.iwidth);
|
||||
text_font.leading();
|
||||
text_font.resetLeading();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4287,6 +4287,25 @@ public class PGraphics extends PImage
|
||||
}
|
||||
|
||||
|
||||
public void text(String s, float x, float y, float w, float h) {
|
||||
text(s, x, y, 0, w, h);
|
||||
}
|
||||
|
||||
public void text(String s, float x, float y, float z, float w, float h) {
|
||||
if (text_font == null) {
|
||||
System.err.println("text(): first set a font before drawing text");
|
||||
return;
|
||||
}
|
||||
if (text_mode == ALIGN_CENTER) {
|
||||
x -= text_font.width(s) / 2f;
|
||||
|
||||
} else if (text_mode == ALIGN_RIGHT) {
|
||||
x -= text_font.width(s);
|
||||
}
|
||||
text_font.text(s, x, y, z, this);
|
||||
}
|
||||
|
||||
|
||||
public void text(int num, float x, float y) {
|
||||
text(String.valueOf(num), x, y, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user