1 | /*--------------------------------*-C-*---------------------------------*; |
1 | /*--------------------------------*-C-*---------------------------------*; |
2 | * File: defaultfont.C |
2 | * File: defaultfont.C |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * Copyright (c) 2003 Marc Lehmann rxvt@plan9.de> |
4 | * Copyright (c) 2003-2004 Marc Lehmann <pcg@goof.com> |
5 | * - original version. |
5 | * - original version. |
6 | * |
6 | * |
7 | * This program is free software; you can redistribute it and/or modify |
7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by |
8 | * it under the terms of the GNU General Public License as published by |
9 | * the Free Software Foundation; either version 2 of the License, or |
9 | * the Free Software Foundation; either version 2 of the License, or |
… | |
… | |
876 | FT_Set_Pixel_Sizes (face, 0, ftheight = prop.height); |
876 | FT_Set_Pixel_Sizes (face, 0, ftheight = prop.height); |
877 | } |
877 | } |
878 | |
878 | |
879 | XftUnlockFace (f); |
879 | XftUnlockFace (f); |
880 | |
880 | |
881 | d = XftDrawCreate (DISPLAY, DRAWABLE, r->display->visual, r->display->cmap); |
|
|
882 | if (!d) |
|
|
883 | return false; |
|
|
884 | |
|
|
885 | return true; |
881 | return true; |
886 | } |
882 | } |
887 | |
883 | |
888 | bool |
884 | bool |
889 | rxvt_font_xft::has_codepoint (uint32_t unicode) |
885 | rxvt_font_xft::has_codepoint (uint32_t unicode) |
… | |
… | |
894 | void |
890 | void |
895 | rxvt_font_xft::draw (int x, int y, |
891 | rxvt_font_xft::draw (int x, int y, |
896 | const text_t *text, int len, |
892 | const text_t *text, int len, |
897 | int fg, int bg) |
893 | int fg, int bg) |
898 | { |
894 | { |
|
|
895 | d = XftDrawCreate (DISPLAY, DRAWABLE, r->display->visual, r->display->cmap); |
|
|
896 | |
899 | if (bg >= 0 && bg != Color_bg) |
897 | if (bg >= 0 && bg != Color_bg) |
900 | XftDrawRect (d, &r->PixColors[bg].c, x, y, r->TermWin.fwidth * len, r->TermWin.fheight); |
898 | XftDrawRect (d, &r->PixColors[bg].c, x, y, r->TermWin.fwidth * len, r->TermWin.fheight); |
901 | else |
899 | else |
902 | clear_rect (x, y, r->TermWin.fwidth * len, r->TermWin.fheight, bg); |
900 | clear_rect (x, y, r->TermWin.fwidth * len, r->TermWin.fheight, bg); |
903 | |
901 | |
… | |
… | |
1069 | } |
1067 | } |
1070 | |
1068 | |
1071 | return true; |
1069 | return true; |
1072 | } |
1070 | } |
1073 | |
1071 | |
1074 | void |
1072 | bool |
1075 | rxvt_fontset::populate (const char *desc) |
1073 | rxvt_fontset::populate (const char *desc) |
1076 | { |
1074 | { |
1077 | clear (); |
1075 | clear (); |
1078 | |
1076 | |
1079 | fonts.push_back (new_font (0, CS_UNICODE)); |
1077 | fonts.push_back (new_font (0, CS_UNICODE)); |
… | |
… | |
1091 | add_fonts ("fixed"); |
1089 | add_fonts ("fixed"); |
1092 | base_id = fonts.size () - 1; |
1090 | base_id = fonts.size () - 1; |
1093 | } |
1091 | } |
1094 | |
1092 | |
1095 | if ((int)fonts.size () <= base_id || !realize_font (base_id)) |
1093 | if ((int)fonts.size () <= base_id || !realize_font (base_id)) |
1096 | { |
1094 | return false; |
1097 | fprintf (stderr, "unable to load a base font, please provide one using -fn fontname\n"); |
|
|
1098 | exit (1); |
|
|
1099 | } |
|
|
1100 | |
1095 | |
1101 | base_prop = fonts[base_id]->properties (); |
1096 | base_prop = fonts[base_id]->properties (); |
|
|
1097 | |
|
|
1098 | return true; |
1102 | } |
1099 | } |
1103 | |
1100 | |
1104 | int |
1101 | int |
1105 | rxvt_fontset::find_font (uint32_t unicode) |
1102 | rxvt_fontset::find_font (uint32_t unicode) |
1106 | { |
1103 | { |