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

Add formatting to FooScript #63

Merged
merged 6 commits into from
Mar 23, 2024
Merged

Add formatting to FooScript #63

merged 6 commits into from
Mar 23, 2024

Conversation

ludouzi
Copy link
Collaborator

@ludouzi ludouzi commented Mar 22, 2024

Brings formatting support to FooScript using tags such as <b>text</b>. The closing tag is optional, but if not used, everything up to the end of the string will be formatted. Some tags require options to be passed like: <size=14>text. This support greatly simplifies customising playlist presets, and will open up an even deeper level of customisation down the line.

The alternative is to use a QTextDocument in the playlist delegate to draw rich text, but this was found to be significantly detrimental to performance. The performance impact of tags in FooScript is negligible, though it does come with a small memory increase depending on the playlist size and formatting options used. This could be reduced/eliminated by caching the fonts and colours.

This also changes how the script scanner/lexer works. Instead of reading token by token, it tokenises the entire script at setup. This allows parsers to 'peek' ahead, and is required by the formatter in order to properly process tags.

@ludouzi ludouzi merged commit db48ffc into master Mar 23, 2024
17 checks passed
@ludouzi ludouzi deleted the scriptformatting branch March 23, 2024 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant