processing / processing/p5.js

text() with maxWidth and maxHeight removes '\t' tabs

Open
#8,469 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area:Core Area:Typography Bug
Dominant language
JavaScript
Stars
24k
Forks
3.8k
Avg merge
3d 16h
Merged PRs (30d)
25

Description

Most appropriate sub-area of p5.js?
  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • p5.strands
  • WebGL
  • DevOps, Build process, Unit testing
  • Internationalization (i18n)
  • Friendly Errors
  • Other (specify if possible)
p5.js version

1.11.11

Web browser and version

Chrome 143.0.7499.193

Operating system

MacOSX 13.6.5

Steps to reproduce this
Steps:
  1. Create text() with text containing tabs \t
  2. Give textbox a maxWidth and maxHeight
  3. Tabs are stripped from text
Snippet:

function setup() {
	createCanvas(windowWidth, windowHeight)
}

function draw() {
	background(0)
	fill(255)
	let txt = 'here is \n\tsome text'
	textSize(50)
	text(txt, 0, 0) // has tabs
	// text(txt, 0, 0, width, height) // removes tabs
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the p5.js text() behavior shown in the reproduction snippet, comparing calls with and without maxWidth and maxHeight. Confirm that tab characters are preserved when constrained text is rendered, and verify the result by rerunning the provided browser example.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.