Skip to content

[p5.js 2.0 Beta Bug Report]: textAlign(CENTER) broken in WebGL #7480

Closed
@davepagurek

Description

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)

p5.js version

2.0 beta 1

Web browser and version

Firefox

Operating system

MacOS

Steps to reproduce this

Steps:

  1. Load a font in WebGL mode
  2. Apply textAlign(CENTER, CENTER)
  3. Draw text with the font

If you comment out the text alignment, it draws, or if you keep the alignment but use 2D mode, but not in WebGL mode, where nothing draws.

Snippet:

let font
async function setup() {
  createCanvas(400, 400, WEBGL);
  font = await loadFont("https://fonts.gstatic.com/s/inter/v18/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuLyfMZhrib2Bg-4.ttf")
}

function draw() {
  background(220);
  textFont(font)
  textSize(60)
  textAlign(CENTER, CENTER)
  text('2.0', 0, 0)
}

Live: https://editor.p5js.org/davepagurek/sketches/3tvKSumGq

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions