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

x/image/font/opentype: Thai language font does not render properly #43383

Open
zapkub opened this issue Dec 26, 2020 · 1 comment
Open

x/image/font/opentype: Thai language font does not render properly #43383

zapkub opened this issue Dec 26, 2020 · 1 comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@zapkub
Copy link

zapkub commented Dec 26, 2020

What version of Go are you using (go version)?

$ go version go1.15.6 darwin/amd64

Does this issue reproduce with the latest release?

Yes,

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/rungsikorn.r/Library/Caches/go-build"
GOENV="/Users/rungsikorn.r/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/rungsikorn.r/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/rungsikorn.r/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/rungsikorn.r/go/src/***********/sliputil/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/78/kqk2z8953g9gy7z_lg29zqkr0000gq/T/go-build201421536=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I use opentype to render text to image with Thai language character and it rendered incorrectly

What did you expect to see?

The "tone mark" and the "vowel" should be rendered in the right places

มั้ย เนื้อ อื้อ เป็น เบิ้ด หนึ่งหมื่น ฏู ญู  ฤา 

compare to the render result. The glyph which is rendered above and below the line does not pick a glyph correctly
image
(image from http://aodr.org/_common/do.php?a=full&b=12&bidx=717&aidx=9769 )

What did you see instead?

image

opentype must pick the right glyph from the character index table which need to be calculated from the combination rules of the Thai language

C90 Thai character combination rules

#27281

@gopherbot gopherbot added this to the Unreleased milestone Dec 26, 2020
@zapkub
Copy link
Author

zapkub commented Dec 26, 2020

I have already try to achieve the correct result which needs to be

  • support post script info table parsing (which already support in opentype package)
  • calculate the combination of Thai glyph rules

some work in process here golang/freetype#81 but I found this package is likely to deprecate so I will focus on change in x/image/font/opentype to apply Thai glyph combination rules

Ligature example

B = Base
U = Upper Vowel
L = Lower Vowel
T = Tone mark

B + U + T
ม + ั + ้ = มั้ย

@dmitshur dmitshur added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Dec 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants