Skip to content

Commit

Permalink
add Measure by function Text notes
Browse files Browse the repository at this point in the history
  • Loading branch information
george012 committed Aug 14, 2024
1 parent 3fdb082 commit 808ff83
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drawings.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,14 @@ func DrawRtl(text string, x, y int) {
C.go_fltk_rtl_draw(textStr, C.int(len(text)), C.int(x), C.int(y))
}

// MeasureText
/*
en: Measure the length and width of a string in fltk_go in UI pixels;;
zh-CN: 测量字符串在`fltk_go`中的 所占用UI像素的 长度和宽度;
@params [☑]text en: text sting type; zh-CN: `sting`格式;
@params [☑]draw_symbols en: Whether to handle special symbols in strings; zh-CN: 是否处理字符串中的特殊符号;
@return [☑]width int,high int en: Returns the font height and width; zh-CN: 返回字体高和宽;
*/
func MeasureText(text string, draw_symbols bool) (int, int) {
textStr := C.CString(text)
defer C.free(unsafe.Pointer(textStr))
Expand Down
12 changes: 12 additions & 0 deletions fltk_go.go
Original file line number Diff line number Diff line change
Expand Up @@ -591,10 +591,22 @@ func _go_drawBox56(x, y, w, h C.int, c C.uint) {
setBoxTypeCb[56](int(x), int(y), int(w), int(h), Color(c))
}

// VersionByFltk [☑]Option
/*
en: Get `fltk` binding version;
zh-CN: 获取绑定的`fltk`版本;
@return [☑]string en: version string;zh-CN: 版本字符串;
*/
func VersionByFltk() string {
return "v1.4.0"
}

// Version [☑]Option
/*
en: Get `fltk_go` version;
zh-CN: 获取`fltk_go`版本;
@return [☑]string en: version string;zh-CN: 版本字符串;
*/
func Version() string {
return config.ProjectVersion
}

0 comments on commit 808ff83

Please sign in to comment.