Follow

Mouse-picking in a proportional font text-area is a problem that just keeps on giving 👍

· · Web · 3 · 1 · 10

@neauoire When you see a specific problem, I'd be curious if you see it in lines.love as well. If not, maybe I can point you at the LÖVE abstraction for ideas to steal.

@akkartik thanks :) My issue is almost more about file seeking than rendering/positioning.

I struggle with loading the last token on a line, testing if it overflows to the next, and then rewinding that token properly to draw it on the following line. Uxntal doesn't have a rewinding API.

@akkartik yeah, that's what I do, I stream a file 1 character at a time, build tokens, get the token's proportional width, and check if it overflows.

I need to untangle how to put that "spent" token string into the buffer to draw.

@neauoire What I've done in the past is cascade levels of buffering.

Level 0: read byte from file
Level 1: buffer 1 byte, read from level 0
Level 2: buffet into a token from level 1
etc.

You can go up to lines, paragraphs, as high as you want.

At each level, manage the buffer as a single static stream. Small streams are cheap (in my experience)

@akkartik that's a good idea, I'd love to handle some things as paragraphs for stylish.

I think you've given me an idea. brb

@neauoire lovely font. I will give it a spin on my playdate for sure.

@caffo I'll make you a pdx when I've ironed out the last rough edges :)

@neauoire punctuation is jacked…”at” is doubled…quotes don’t seem to be working right.

Sign in to participate in the conversation
Merveilles

Revel in the marvels of the universe. We are a collective of forward-thinking individuals who strive to better ourselves and our surroundings through constant creation. We express ourselves through music, art, games, and writing. We also put great value in play. A warm welcome to any like-minded people who feel these ideals resonate with them.