You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

runewidth_windows.go 456B

12345678910111213141516171819202122232425262728
  1. // +build windows
  2. // +build !appengine
  3. package runewidth
  4. import (
  5. "syscall"
  6. )
  7. var (
  8. kernel32 = syscall.NewLazyDLL("kernel32")
  9. procGetConsoleOutputCP = kernel32.NewProc("GetConsoleOutputCP")
  10. )
  11. // IsEastAsian return true if the current locale is CJK
  12. func IsEastAsian() bool {
  13. r1, _, _ := procGetConsoleOutputCP.Call()
  14. if r1 == 0 {
  15. return false
  16. }
  17. switch int(r1) {
  18. case 932, 51932, 936, 949, 950:
  19. return true
  20. }
  21. return false
  22. }