Skip to content
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

CJK brackets at the beginning of paragraph #4011

Open
1 task done
minamotorin opened this issue Apr 25, 2024 · 11 comments
Open
1 task done

CJK brackets at the beginning of paragraph #4011

minamotorin opened this issue Apr 25, 2024 · 11 comments
Labels
feature request New feature or request text Text layout, shaping, internationalization, etc.

Comments

@minamotorin
Copy link

Description

When paragraph indentation is enabled, positioning of brackets at the beginning of paragraph doesn't follow §3.1.5 of Requirements for Japanese Text Layout.
Example code is below.

// This program is public domain (CC0).
#set page(
  width: 210mm,
  margin: (left: 30mm, right: 210mm-30mm-10em),
)
#set par(
  leading: 1em
)
#show par: set block(
  spacing: 2.5em
)

「日日日日日日日日日「日

#set par(first-line-indent: 1em)

「日日日日日日日日「日

#h(-0.5em)「日日日日日日日日「日

brac

The first paragraph is an example of paragraph indentation is not enabled, and the second one is an example of paragraph indentation is enabled.

The third paragraph is an example of the expected result that follows §3.1.5 of Requirements for Japanese Text Layout.

Thanks.

Reproduction URL

No response

Operating system

macOS

Typst version

  • I am using the latest version of Typst
@minamotorin minamotorin added the bug Something isn't working label Apr 25, 2024
@Leedehai
Copy link
Contributor

https://typst.app/docs/reference/model/par/#parameters-first-line-indent mentioned "Only the first line of a consecutive paragraph will be indented (not the first one in a block or on the page)." -- a limitation, yes.. Typst wants to change that but it's not trivial.

@laurmaedje
Copy link
Member

I think the issue here differs from #311. If I'm understanding correctly, it's more that a bracket shouldn't disrupt the grid-like alignment of characters.

@laurmaedje laurmaedje added the text Text layout, shaping, internationalization, etc. label Apr 29, 2024
@minamotorin
Copy link
Author

The key point of this issue is that the space between left edge of paragraph and “「” is effectively 1.5 em, not the 1 em specified by #set par(first-line-indent: 1em).

@peng1999
Copy link
Contributor

peng1999 commented May 19, 2024

The third paragraph is an example of the expected result that follows §3.1.5 of Requirements for Japanese Text Layout.

Note that JLREQ provides three possible options in that chapter, and Typst just behaves the same as option ③ optoin ① in Figure 71. So the current behavior is indeed conform to JLREQ. This issue should be a feature request rather than a bug report.

cc @Enivex maybe you want to change the issue tags and names.


Edit: See below

@Enivex Enivex added feature request New feature or request and removed bug Something isn't working labels May 19, 2024
@minamotorin
Copy link
Author

minamotorin commented May 19, 2024

@peng1999

Typst just behaves the same as option ③ in Figure 71.

No. Option 3 require the space between the left edge of the paragraph and “「” at the beginning of a paragraph to be 1/2 em, but the actual space is 3/2 em as I described first.
This is same as option 2 rather than option 3.

However, option 2 require the space between the left edge of the paragraph and “「” at the beginning of a line in the middle of a paragraph to be 1/2 em. But the actual space is 0 em.
This is same as option 1 or option 3.

Figure 71 of JLREQ
(Quoted from Figure 71 of Requirements for Japanese Text Layout by W3C, permissive document license.)


feature request

Of course, it is better the user can choose which option to use.

@peng1999
Copy link
Contributor

peng1999 commented May 19, 2024

No. Option 3 require the space between the left edge of the paragraph and “「” at the beginning of a paragraph to be 1/2 em, but the actual space is 3/2 em as I described first.

Sorry, I made a mistake. The problem you provide do exist. And I made another mistake in previous comment: Typst currently follows option ①, not ③.

And the bug is: CJK punctuation at the start of paragraphs are not adjusted sometimes, and it is tracked in #2348.

So your issue splits into two parts: the bug part is a duplication of #2348, and the feature request part is valid. But I suggest change the name the issue to something like "Options for Positioning of Opening Brackets".

@minamotorin
Copy link
Author

minamotorin commented May 19, 2024

@peng1999

So your issue splits into two parts: the bug part is a duplication of #2348, and the feature request part is valid.

I couldn't find #2348 in the past and this issue is duplicate of it. Thanks!

I close this because this is just duplicate of #2348 and I think that feature request should be discussed in separated new issue.

@minamotorin minamotorin closed this as not planned Won't fix, can't repro, duplicate, stale May 19, 2024
@minamotorin
Copy link
Author

minamotorin commented May 19, 2024

This is not duplicate of #2348.

The cause of #2348 seems to be that the space between the left edge of the paragraph and “「” at the beginning of a paragraph is used to adjust the line length.
But this issue is about the amount of the space before it is used for adjustment.

@minamotorin minamotorin reopened this May 19, 2024
@minamotorin
Copy link
Author

@peng1999
I think current behavior of typst does not satisfy any of option in Requirements for Japanese Text Layout.
Option 1 require the space between the left edge of the paragraph and “「” at the beginning of a paragraph to be 1 em, but the actual space is 3/2 em.

Here is table about amount of indentation.

paragraph starting with “「” line starting with “「” and not beginning of paragraph normal beginning of paragraph
Option 1 of §3.1.5 of Requirements for Japanese Text Layout 1 em 0 em 1 em
Option 2 of §3.1.5 of Requirements for Japanese Text Layout 3/2 em 1/2 em 1 em
Option 3 of §3.1.5 of Requirements for Japanese Text Layout 1/2 em 0 em 1 em
typst (with #set par(first-line-indent: 1em)) 3/2 em 0 em 1 em

But if this is the typst specification, this is definitely a feature request.

@peng1999
Copy link
Contributor

The cause of #2348 seems to be that the space between the left edge of the paragraph and “「” at the beginning of a paragraph is used to adjust the line length.
But this issue is about the amount of the space before it is used for adjustment.

Suppose we have first-line-indent set to 1em and the first character is . Currently in Typst it becomes: <1em fixed space> + <0.5em shrinkable space> + <half width >

In summary, the two issue is essentially the same and can be fixed by a single action: remove the shrinkable space.

@minamotorin
Copy link
Author

the two issue is essentially the same and can be fixed by a single action: remove the shrinkable space.

I agree about the solution.
But I'll keep this issue open because #2348 can be fixed with a different solution, make the space unshrinkable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request text Text layout, shaping, internationalization, etc.
Projects
None yet
Development

No branches or pull requests

5 participants