Skip to content

Commit

Permalink
Attempting to make better the conditions causing this:
Browse files Browse the repository at this point in the history
  • Loading branch information
madhephaestus committed Nov 16, 2024
1 parent b0de6e1 commit e4e247a
Show file tree
Hide file tree
Showing 3 changed files with 318 additions and 141 deletions.
22 changes: 17 additions & 5 deletions src/main/java/eu/mihosoft/vrl/v3d/Text3d.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
public class Text3d extends Primitive {

private final PropertyStorage properties = new PropertyStorage();
ArrayList<CSG> letters;
private final ArrayList<CSG> letters = new ArrayList<CSG>();
/**
* Constructor.
*
Expand Down Expand Up @@ -76,9 +76,17 @@ public Text3d(String text, double depth) {
public Text3d(String text, String fontName, double fontSize, double depth) {

Font font = new Font(fontName, (int) fontSize);
letters = TextExtrude.text( depth, text, font);
for (int i=0;i<letters.size();i++){
letters.set(i, letters.get(i)
if(!font.getName().toLowerCase().contains(fontName.toLowerCase())) {
String options = "";
for(String name : javafx.scene.text.Font.getFontNames() ) {
options+=name+"\n";
}
new Exception(options).printStackTrace();
}
ArrayList<CSG> tmp = TextExtrude.text( depth, text, font);
letters.clear();
for (int i=0;i<tmp.size();i++){
letters.add( tmp.get(i)
.rotx(180)
.toZMin()
);
Expand All @@ -89,7 +97,11 @@ public Text3d(String text, String fontName, double fontSize, double depth) {

@Override
public List<Polygon> toPolygons() {
return letters.get(0).union(letters).getPolygons();
List<Polygon> poly =new ArrayList<Polygon>();
for(CSG c:letters) {
poly.addAll(c.getPolygons());
}
return poly;
}

@Override
Expand Down
Loading

0 comments on commit e4e247a

Please sign in to comment.