Skip to content

Conversation

Drulokia
Copy link
Collaborator

@Drulokia Drulokia commented Aug 24, 2025

BBCode Support for SDF Text Renderer

afbeelding

This implementation adds BBCode parsing capabilities to the SDF WebGL text renderer

Features

The BBCode parser supports the following tags:

Color Tags

  • [color=red]text[/color] - Named colors (red, green, blue, white, black, yellow, cyan, magenta, orange, purple, pink, gray/grey)
  • [color=#FF0000]text[/color] - Hex colors (3, 6, or 8 digit hex)
  • [color=#F00]text[/color] - Short hex format

Nested Tags

Tags can be nested for combined effects:

[color=red][u]red bold text[/u][/color]

Usage

// Create a text node with BBCode formatting
const textNode = renderer.createTextNode({
  text: 'Hello [color=red]red text[/color] and [s]bold text[/s]!',
  fontSize: 24,
  fontFamily: 'Ubuntu',
  x: 100,
  y: 100,
  parent: parentNode,
});

Still TODO:

  • Italic
  • Bold
  • When underline/strikethrough start on a line and cross over to next line only part of text that is on last line has the decoration.

@Drulokia Drulokia marked this pull request as draft August 24, 2025 10:40
@Drulokia Drulokia changed the title BBcode handling, currently supported color, underline, strikethrough [WIP] BBcode handling, currently supported color, underline, strikethrough Aug 24, 2025
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.

1 participant