Skip to content

WebGL text.js: complete TODO implementations and replace console.log with FES #8579

@MASTERsj01

Description

@MASTERsj01

Increasing access

Completing unfinished TODO implementations improves the reliability of WebGL text rendering. Using FES for error messages ensures consistency and helps beginners understand issues with clear, friendly warnings that can be controlled via p5.disableFriendlyErrors.

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Build process
  • Unit testing
  • Internationalization
  • Friendly errors
  • Other (specify if possible)

Feature enhancement details

src/webgl/text.js has several unfinished TODOs and raw console.log calls:

  1. _applyTextProperties() (line 7-12) — marked @TODO finish implementation, missing return value
  2. textWidth() (line 20) — silently returns 0 with a // TODO: error comment when font is not OpenType
  3. _renderText() (line 646, 656) — uses raw console.log instead of p5._friendlyError() for missing font warnings

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions