int main(void) { printf("0 %d\n",strcmp0("hello","hello")); printf("1 %d\n",strcmp0("helloo","hell")); printf("1 %d\n",strcmp0("hello","hella")); printf("-1 %d\n",strcmp0("hell","helloo")); printf("-1 %d\n",strcmp0("hella","hello")); return 0; }
int gra2cairo_charheight(struct objlist *obj, N_VALUE *inst, N_VALUE *rval, int argc, char **argv) { struct gra2cairo_local *local; char *font; double size, dir, s, c; char *func; int height, descent, ascent, style, symbol; struct fontmap *fcur; func = (char *)argv[1]; size = (*(int *)(argv[3])) / 72.0 * 25.4; font = (char *)(argv[4]); style = *(int *) (argv[5]); if (size == 0) { rval->i = 0; return 0; } if (_getobj(obj, "_local", inst, &local)) return 1; if (local->cairo == NULL) return 1; if (strcmp0(func, "_charascent") == 0) { height = TRUE; } else { height = FALSE; } fcur = loadfont(font, style, &symbol); if (fcur == NULL) { if (height) { rval->i = nround(size * 0.562); } else { rval->i = nround(size * 0.250); } return 0; } dir = local->fontdir; s = local->fontsin; c = local->fontcos; local->fontdir = 0; local->fontsin = 0; local->fontcos = 1; draw_str(local, FALSE, "A", fcur, size, 0, NULL, &ascent, &descent); if (height) { rval->i = mxp2dh(local, ascent); } else { rval->i = mxp2dh(local, descent); } local->fontsin = s; local->fontcos = c; local->fontdir = dir; return 0; }