Skip to content

Implement basic vertical text direction support#7399

Closed
SFizz405 wants to merge 1 commit intotypst:mainfrom
doss-eeic:basic-vertical-text-support
Closed

Implement basic vertical text direction support#7399
SFizz405 wants to merge 1 commit intotypst:mainfrom
doss-eeic:basic-vertical-text-support

Conversation

@SFizz405
Copy link

Overview

This PR adds very minimal vertical text direction (mainly TTB-RTL) support. TTB and BTT directions were already present in the code, but were largely unimplemented and ignored; this PR attempts to implement some of the basic required features. The features proposed in RFC #5908 are not implemented at all: hopefully this PR provides the basis.

Importantly, merging this PR should not alter the output of any .typ file, unless the text direction is explicitly set to TTB (with something like set #text(dir: ttb)).

Changes

Since the goal was to extend the support of text directions (LTR, RTL) to vertical directions, most of the changes abstract direction for logic written with horizontal text direction in mind. Additions of new fields to structs were avoided when the struct is widely used, while new fields were added to structs that were primarily used with text direction logic.

Issues

The support for vertical text direction is minimal at best, and some essential features are left unimplemented. Some missing essential features include:

  • Inserting figures or pretty much anything other than basic text
  • Mixing vertical and horizontal text
  • Page breaking
  • Preventing single newlines from inserting spaces (spaces are rarely used in TTB-RTL, at least in Japanese)

Notes

Most of the testing was done in Japanese. Using other languages may produce more bugs.

This PR was written by @SFizz405, @RaikiSakaguchi, and @GenOgane. This is our first ever PR to a large repo, and we do not have a lot of experience with Rust; apologies in advance for any bad code. We understand that our PR may not meet the minimal required quality for merging.

Co-authored-by: RaikiSakaguchi <[email protected]>
Co-authored-by: GenOgane <[email protected]>
@SFizz405 SFizz405 changed the title Implements basic vertical text direction support Implement basic vertical text direction support Nov 17, 2025
@SFizz405
Copy link
Author

Will create a new PR after fixing issues with the checks.

@SFizz405 SFizz405 closed this Nov 17, 2025
@Enivex
Copy link
Collaborator

Enivex commented Nov 17, 2025

Will create a new PR after fixing issues with the checks.

I strongly suggest communicating with the team on discord before creating one

@laurmaedje
Copy link
Member

Thanks for your effort, but a PR for vertical writing is not something we would merge at this time as we do not have sufficient capacity to maintain and quality control these code paths.

@SFizz405
Copy link
Author

Thank you for the comments. We apologize for not following the contribution steps and communicating before implementing: this was a class project at uni, and we didn't plan on contributing at all when we made the changes.

Thanks for Typst, and good luck to anyone attempting to implement vertical text support.

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.

3 participants