-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix(TextMetrics): rtl direction + start/end textAlign #2510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any other test/thing I should add/do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks and I'm glad to see new tests! Need a couple of changes I think.
it("2d.type class string", function () { | ||
const canvas = createCanvas(100, 50); | ||
const ctx = canvas.getContext("2d"); | ||
assert.strictEqual(Object.prototype.toString.call(ctx), '[object CanvasRenderingContext2D]') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did this need to be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran npm run generate-wpt
- this is outdated code I believe
test/wpt/text-styles.yaml
Outdated
|
||
ctx.textAlign = "left" | ||
metrics = ctx.measureText('hello'); | ||
@assert metrics.actualBoundingBoxLeft < metrics.actualBoundingBoxRight; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this goes here. This test is imported from the WPT tests, so it would get overwritten if they did any updates. You should be able to write this in canvas.test.js
though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought the yaml files generate the js test files. Regardless I saw nothing runs these tests on CI
This reverts commit 7f782ae.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reverted the pwt changes in favor of the jest test and exposed resolveTextAlignment
as requested
@@ -2557,6 +2557,20 @@ inline double getBaselineAdjustment(PangoLayout* layout, short baseline) { | |||
} | |||
} | |||
|
|||
text_align_t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I expose a strict text align enum?
enum text_align_strict_t : int8_t {
STRICT_TEXT_ALIGNMENT_LEFT = TEXT_ALIGNMENT_LEFT,
STRICT_TEXT_ALIGNMENT_CENTER = TEXT_ALIGNMENT_CENTER,
STRICT_TEXT_ALIGNMENT_RIGHT = TEXT_ALIGNMENT_RIGHT
};
Thanks for contributing!
closes #2508