it is 1 of 2 parts. the second part (i also did) fits on the cone of the part you see in the picture. when both are assembled together they inject something inside. it is meant for the agriculture. but i dont know exactly what it does.
btw i am working right now on a b4j app that will simulate engraving and also create the gcode. i already did the gcode creation now i only need to make the simulation. i am also planing to make a very very simple 3axis cnc app where you can create simple parts and output Gcode. this will be very interesting
Ilan,
See the google store app "Text to CNC".
I have read some articles that talk about manipulating TTF fonts or "engraving fonts" and I think that is the way. Would you or anyone here from the fourm help me with any code? I have no idea how to do this.
Ilan,
See the google store app "Text to CNC".
I have read some articles that talk about manipulating TTF fonts or "engraving fonts" and I think that is the way. Would you or anyone here from the fourm help me with any code? I have no idea how to do this.
creating the gcode is really easy i already do it in my code but if you plan to do that with several fonts that will need some work.
i am not planning to waste to much time on this project but i will try to make a basic app that will work.
if a font would output a path it would be much simpler. so try to find a way to convert a text to a path of lines or dots and then it will be simple to create from that a gcode.
you know what i have a good idea how to do that. but it could be a slow process to get the path. i was thinking of drawing the text on a white background with black textcolor then go through all pixels and if pixel is black add that dot to an array and then i will have an array of all dots and then i could create a path out of it.
I am very close to a solution that will get the outer frame and inner frane of a letter and create a path of it and get the xy coordinates for the gcode output.
The problem in this is to get the points sorted so u can go from each point to the other and create the letter out of it.
But i have a solution. i will need to test it and see the performance. This lib could be used in many scenarios. But first i need to get it working for my app
you can see in the picture that i am getting the dots from the letters (it can be done with any font) and now i am trying to sort them so you can go with the spotdrill and engrave the letters in a cnc machine.
i have already an idea how to sort them right and create a path for the cnc program that will also reduce as much dots as possible so the cnc program will not be too long. for now i am just getting the dots and what i need now is to sort them right in my list and reduce unnecessary dots.
after some test i found a different code much accurate then this one:
B4X:
Sub measureTextWidth(Text As String, font As Font) As Float
Dim lbl As Label
lbl.Initialize("")
lbl.Text = Text
lbl.Font = font
MainForm.RootPane.AddNode(lbl,0,0,-1,-1)
lbl.Snapshot
lbl.RemoveNodeFromParent
Return lbl.Width
End Sub
with this code i am getting a very accurate width of the letter with the Segoe Script font but your example above using b4x canvas mesuretext does not give me an accurate result.
this is my code:
B4X:
Sub measureTextWidth(Text As String, font As Font) As Float
Dim cnx As B4XCanvas
cnx.Initialize(MainForm.RootPane)
Return cnx.MeasureText(Text, font).Width
' Dim lbl As Label
' lbl.Initialize("")
' lbl.Text = Text
' lbl.Font = font
' MainForm.RootPane.AddNode(lbl,0,0,-1,-1)
' lbl.Snapshot
' lbl.RemoveNodeFromParent
' Return lbl.Width
End Sub
and result:
you can see it is not that accurate so the code with the label is working much better.
in my opinion it looks good enough but i could increase the dots amount and get a much accurate result. the question is what needs you have with that lib??
Kerning is the space between individual characters. As each character can be followed by many different characters, there needs to be a lookup table with all the combinations. This is called kerning pairs, and it's something that typographers spend many, many hours perfecting for each typeface.
I'm afk at the moment so difficult to illustrate with your screenshots, but take a look at https://en.wikipedia.org/wiki/Kerning to see some illustrations.
And as Erel hinted, don't underestimate the complexity of kerning - it's a seriously difficult problem to solve.
I'm not exactly sure what you are measuring. DrawTextWithBorder seems to be accurate with this font:
B4X:
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("1") 'Load the layout file.
MainForm.Show
Dim cvs As B4XCanvas
cvs.Initialize(Pane1)
Dim fnt As Font = jFX.CreateFont("Segoe Script", 150, False, False)
DrawTextWithBorder(cvs, "VAN", fnt, xui.Color_Red, Pane1.Width / 2, Pane1.Height / 2)
cvs.Invalidate
End Sub
Kerning is the space between individual characters. As each character can be followed by many different characters, there needs to be a lookup table with all the combinations. This is called kerning pairs, and it's something that typographers spend many, many hours perfecting for each typeface.
This is not relevant for my needs. In cnc you need to leave some space between letters they should not be to close. Anyway it is very simple to do what u are asking but i didnot do it in my app. But i can show you that it is possible.
Example with a different Font and kerning!:
you can see that the letters are inside each other.