Skip to content

Commit

Permalink
FIX: macOS: better handling the para facet
Browse files Browse the repository at this point in the history
  • Loading branch information
qtxie committed Jun 25, 2017
1 parent e60bcc7 commit 1657f12
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions modules/view/backends/macOS/font.reds
Expand Up @@ -192,6 +192,7 @@ make-font-attrs: func [
values [red-value!]
blk [red-block!]
style [red-word!]
o-para [red-object!]
nsfont [integer!]
nscolor [integer!]
len [integer!]
Expand Down Expand Up @@ -233,11 +234,18 @@ make-font-attrs: func [
under: CFNumberCreate 0 15 :under
strike: CFNumberCreate 0 15 :strike

len: -1
if TYPE_OF(face) = TYPE_OBJECT [
o-para: as red-object! (object/get-values face) + FACE_OBJ_PARA
if TYPE_OF(o-para) = TYPE_OBJECT [len: 3 and get-para-flags type o-para]
]
if all [type = button len = -1][len: NSTextAlignmentCenter]

para: 0
if type = button [
if len <> -1 [
para: objc_msgSend [objc_getClass "NSParagraphStyle" sel_getUid "defaultParagraphStyle"]
para: objc_msgSend [para sel_getUid "mutableCopy"]
objc_msgSend [para sel_getUid "setAlignment:" NSTextAlignmentCenter]
objc_msgSend [para sel_getUid "setAlignment:" len]
]

attrs: objc_msgSend [objc_getClass "NSDictionary" sel_getUid "alloc"]
Expand Down
2 changes: 1 addition & 1 deletion modules/view/backends/macOS/para.reds
Expand Up @@ -38,7 +38,7 @@ change-para: func [
change-font hWnd face font type
][
flags: get-para-flags type para
objc_msgSend [hWnd sel_getUid "setAlignment:" flags and 0Fh]
objc_msgSend [hWnd sel_getUid "setAlignment:" flags and 3]
]
]
true [0]
Expand Down

0 comments on commit 1657f12

Please sign in to comment.