-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use modern X fonts instead of X core fonts #38
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR looks nice so it should not sink into oblivion. I had a quick look and spotted a few oddities.
| Some pc -> | ||
let packages = [("x11","-lX11"); ("xft", "-lXft")] in | ||
let cflags, libs = | ||
packages | ||
|> List.map (fun (package, fallback) -> | ||
match C.Pkg_config.query pc ~package with | ||
| None -> [], [fallback] | ||
| Some { cflags; libs } -> cflags, libs) | ||
|> List.split | ||
in | ||
List.concat cflags, List.concat libs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ouch. pkg-config
handles multiple package names just fine, e.g. pkg-config --libs xft x11
gives -lXft -lX11
, no need for multiple invocations. But of cours Dune configurator doesn't support this.
The whole discover.ml
file is an embarrassment. It would be 3 times shorter as a shell script.
Also: it would be prudent to link -lXft
before -lX11
, as the former certainly uses symbols from the latter.
XftDrawString8 (d, &xftcol, caml_gr_font, | ||
caml_gr_x, Bcvt(caml_gr_y) - caml_gr_font->descent + 1, | ||
(const FcChar8 *) txt, len); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing XftDrawDestroy(d);
here?
visual, caml_gr_colormap); | ||
XftDrawString8 (d, &xftcol, caml_gr_font, | ||
caml_gr_x, Wcvt(caml_gr_y) - caml_gr_font->descent + 1, | ||
(const FcChar8 *) txt, len); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing XftDrawDestroy(d);
here?
XFlush(caml_gr_display); | ||
} | ||
caml_gr_x += XTextWidth(caml_gr_font, txt, len); | ||
|
||
if (d) XftDrawDestroy (d); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This destroys one XftDraw object but two may have been created. Also, d
is not initialized, if I'm not mistaken, so the if (d)
test is weird.
This is an actualization of the patch proposed in #3 (first issued at ocaml/ocaml#4917), so all credit goes to the original author of the patch (Richard Jones).
I've adapted the machinery to link against the xft library in
discover.ml
, though I have no clue if this is the right way to do it (there may be some other things to tweak for the darwin target).