Skip to content

Shapes from text and typographic play #227

Answered by villares
villares asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks for the help @hx2A, wonderful that py5 exposes Processing's hidden PFont.get_shape()!

Comments and improvement suggestions are welcome, folks!

I think I should add some font size handling, maybe.

import py5
from shapely.geometry import Polygon, MultiPolygon, GeometryCollection, LineString, Point

# Experiment to extract poly shapes from a text rendered in a specific font
# Demo sketch for poly_from_text() and draw_shapely_objs()

def setup():
    global shapes
    py5.size(1200, 400)
    py5.color_mode(py5.HSB)
    py5.stroke(255)
    font = py5.create_font('Inconsolata Bold', 100)
    shapes = polys_from_text(
        'Oi B008!\né o gnumundo®...\nviva a ciberlândia!',
        font)…

Replies: 2 comments 11 replies

Comment options

You must be logged in to vote
8 replies
@villares
Comment options

villares Feb 1, 2023
Collaborator Author

@villares
Comment options

villares Feb 2, 2023
Collaborator Author

@villares
Comment options

villares Feb 2, 2023
Collaborator Author

@hx2A
Comment options

hx2A Feb 2, 2023
Maintainer

@villares
Comment options

villares Feb 2, 2023
Collaborator Author

Comment options

villares
Feb 3, 2023
Collaborator Author

You must be logged in to vote
3 replies
@hx2A
Comment options

hx2A Feb 4, 2023
Maintainer

@villares
Comment options

villares Feb 4, 2023
Collaborator Author

@hx2A
Comment options

hx2A Feb 4, 2023
Maintainer

Answer selected by villares
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants