Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a way to add horizontal spacing to a text fragment #1128

Open
mojavelinux opened this issue Sep 10, 2019 · 1 comment
Open

Provide a way to add horizontal spacing to a text fragment #1128

mojavelinux opened this issue Sep 10, 2019 · 1 comment

Comments

@mojavelinux
Copy link
Contributor

In order to layout text fragments precisely, it's sometimes necessary to add horizontal (left and right) spacing (i.e., padding) to the text. One example is when you want to draw a border around the text or apply a background color. Without the padding, the border/background runs right up against the text. While it's possible to have the border/background extend away from the text, it steals space from between the words. So what's needed is adding padding around the text.

One relatively simple way to support this would be to allow the width of a fragment to be specified. Then the application could be responsible for figuring out how much additional width is needed. But this width needs to be considered when laying out the fragment on the line (the wrap logic).

The current workaround is to add a thin space character on either side of the text. However, the width of thin spaces in fonts vary, so it's hard to control the exact amount of padding that gets added.

@mojavelinux
Copy link
Contributor Author

After I opened this issue, I realized it is already possible to specify the width and alignment of the fragment. So the question becomes, how to do we best determine the width so that the width can be expanded. Perhaps this is an application issue. I'd certainly be interested in a horizontal padding, because it would make it easier, but it's fair to say I could make it work without that support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant