Mercurial > dwindows
comparison mac/dw.m @ 2465:79732eb2deef
Mac: Port control empty text size calculation fix from iOS.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 14 Apr 2021 21:36:45 +0000 |
parents | 5b401a5cfa90 |
children | cfb14192753c |
comparison
equal
deleted
inserted
replaced
2464:4fba0b9453ee | 2465:79732eb2deef |
---|---|
4976 nsstr = [object stringValue]; | 4976 nsstr = [object stringValue]; |
4977 | 4977 |
4978 /* If we have a string... | 4978 /* If we have a string... |
4979 * calculate the size with the current font. | 4979 * calculate the size with the current font. |
4980 */ | 4980 */ |
4981 if(nsstr && [nsstr length]) | 4981 if(nsstr) |
4982 dw_font_text_extents_get(object, NULL, (char *)[nsstr UTF8String], &thiswidth, &thisheight); | 4982 { |
4983 int textwidth, textheight; | |
4984 | |
4985 /* If we have an empty string, use "gT" to get the most height for the font */ | |
4986 dw_font_text_extents_get(object, NULL, [nsstr length] ? (char *)[nsstr UTF8String] : "gT", &textwidth, &textheight); | |
4987 | |
4988 if(textheight > thisheight) | |
4989 thisheight = textheight; | |
4990 if(textwidth > thiswidth) | |
4991 thiswidth = textwidth; | |
4992 } | |
4983 | 4993 |
4984 /* Handle static text fields */ | 4994 /* Handle static text fields */ |
4985 if([object isKindOfClass:[NSTextField class]] && ![object isEditable]) | 4995 if([object isKindOfClass:[NSTextField class]] && ![object isEditable]) |
4986 { | 4996 { |
4987 id border = handle; | 4997 id border = handle; |