microsoft / microsoft/maker.js

How to export SVG with right aligned text ?

Open
#452 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2k
Forks
302
Avg merge
21h 28m
Merged PRs (30d)
5

Description

How to export SVG with right-aligned text (Arabic)?
Below code generate left-aligned text :

var makerjs = require('makerjs')
var textModel;

opentype.load('fonts/Roboto-Black.ttf', function(err, font) {
    if (err)
    {
                alert('Could not load font: ' + err);
    }
    else
    {
		var text = 'Hello World! This box should start word-wrapping!';
                textModel = new makerjs.models.Text(font, text, 45, true, true);
		var svg = makerjs.exporter.toSVG(textModel,{stroke: '#000', fill: '#000'});
		document.write(svg);
    }

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 by tracing the makerjs.models.Text entry point and exporter.toSVG call shown in the example, then inspect how text positioning and SVG output are handled. The issue names no repository files or tests, and it does not define an acceptance criterion for right-aligned Arabic text, so the expected behavior would need clarification before implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.