Skip to main content
Stack Overflow
  1. About
  2. For Teams

Timeline for Draw a traceable text on graphics 2D

Current License: CC BY-SA 4.0

14 events
when toggle format what by license comment
Apr 24, 2024 at 10:43 comment added Holger @MadProgrammer correct. That’s not how fonts work. There’s a reason why these kind of fonts are literally called "outline fonts". The ordinary appearance is solid, because the outline is filled. That’s what Graphics2D’s fill method does. But by passing the result of createStrokedShape to fill, the OP emulated a call to the draw method.
Apr 24, 2024 at 0:13 comment added g00se Perhaps you're right. I think what is required is a single dashed line. So as you hinted, generating Paths might be the way to go
Apr 24, 2024 at 0:06 comment added MadProgrammer @g00se Based on the available information, the OP want's to start with a "dashed" line which the user can then trace, rather then having a solid line. I've not been able to find away to get the "chord" path of the font, based on what little I know, I don't think that's how fonts work
Apr 23, 2024 at 23:51 comment added g00se Well I thought that the idea was to have the kids trace on top of an existing digit. But let's await clarification
Apr 23, 2024 at 23:41 comment added MadProgrammer @g00se But, what I think the OP is trying to do, is apply a custom stroke to the text rendering, so you'd get a dashed line through the "core" of the text, not it's outline, so, no, I don't think that's achievable via the Font and Graphics workflows
Apr 23, 2024 at 23:18 comment added g00se Actually using Font is probably the easiest way to get numbers to trace. The reason I used an image was that was at 'the bottom' of MadProgrammer's painting routine to which I've linked and it was the painting bit I wanted to show. What you can do is to combine showing the numbers via Font with painting (tracing on top of them)
Apr 23, 2024 at 23:05 comment added MadProgrammer I suspect that you're running in the wrong direction. I wouldn't try and use the Font workflow, instead, I'd try and create the shapes yourself. This could be done by either creating or finding a SVG source which had a "core" path (not outline) and then doing something like this to convert it to a Shape, this way you don't run into weird font scaling issues and have a lot more control
Apr 23, 2024 at 22:30 comment added WJS The following might be a useful alternative stackoverflow.com/questions/21039498/…
Apr 23, 2024 at 22:06 comment added Quillion @g00se Ah I finally understood what you said from the explanation you provided. I intend to print what I draw on the Graphics2D, and have them trace it with the pen.
Apr 23, 2024 at 22:03 answer added g00se timeline score: 1
Apr 23, 2024 at 21:59 comment added Quillion Draw string simply draws a string that's solid and not dashed. It's not traceable.
Apr 23, 2024 at 21:56 comment added g00se I would do something like @MadProgrammer does here using an image like this Put g2.setStroke(new BasicStroke(5f)); into mouseDragged
Apr 23, 2024 at 21:20 comment added g00se Surely you'd be getting nearer to allowing your children to trace that 3 if you just called drawString with the correct coordinates?
Apr 23, 2024 at 21:03 history asked Quillion CC BY-SA 4.0

AltStyle によって変換されたページ (->オリジナル) /