diff --git a/textview.go b/textview.go index adb74aa..6b97f74 100644 --- a/textview.go +++ b/textview.go @@ -32,3 +32,8 @@ func (textview *TextView) SetText(text string) { defer C.free(unsafe.Pointer(cText)) C.TextView_SetText(textview.textViewPtr, cText) } + +// SetText sets the text of the text view +func (textview *TextView) SetFontSize(size int) { + C.TextView_SetFontSize(textview.textViewPtr, C.int(size)) +} diff --git a/textview.h b/textview.h index de5c3b6..613b5f5 100644 --- a/textview.h +++ b/textview.h @@ -4,11 +4,12 @@ @interface TextViewHandler : NSObject -@property (assign) int goTextViewId; +@property(assign) int goTextViewId; @end -typedef void* TextViewPtr; +typedef void *TextViewPtr; TextViewPtr TextView_New(int goTextViewId, int x, int y, int w, int h); -void TextView_SetText(TextViewPtr textViewPtr, const char* text); +void TextView_SetText(TextViewPtr textViewPtr, const char *text); +void TextView_SetFontSize(TextViewPtr textViewPtr, int size); diff --git a/textview.m b/textview.m index b300da1..fdbf2fe 100644 --- a/textview.m +++ b/textview.m @@ -15,3 +15,9 @@ void TextView_SetText(TextViewPtr textViewPtr, const char* text) { NSTextView* tv = (NSTextView*)textViewPtr; [tv setString:[NSString stringWithUTF8String:text]]; } + +void TextView_SetFontSize(TextViewPtr textViewPtr, int size) { + NSTextView* tv = (NSTextView*)textViewPtr; + NSFont* font = [NSFont fontWithName:@"Helvetica" size:size]; + [tv setFont:font]; +}