src

Go monorepo.
git clone git://code.dwrz.net/src
Log | Files | Refs

runewidth_windows.go (479B)


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