Font: Remove, oopango took over the job
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
b3ebab0a7e
commit
9deafe68c8
|
@ -43,7 +43,6 @@ set(AWE_SRCS
|
|||
${SOURCE_DIR}/draw.c
|
||||
${SOURCE_DIR}/event.c
|
||||
${SOURCE_DIR}/ewmh.c
|
||||
${SOURCE_DIR}/font.c
|
||||
${SOURCE_DIR}/keygrabber.c
|
||||
${SOURCE_DIR}/keyresolv.c
|
||||
${SOURCE_DIR}/luaa.c
|
||||
|
|
|
@ -483,9 +483,6 @@ main(int argc, char **argv)
|
|||
/* init screens information */
|
||||
screen_scan();
|
||||
|
||||
/* init default font */
|
||||
globalconf.font = font_new("sans 8");
|
||||
|
||||
xutil_lock_mask_get(globalconf.connection, xmapping_cookie,
|
||||
globalconf.keysyms, &globalconf.numlockmask,
|
||||
&globalconf.shiftlockmask, &globalconf.capslockmask,
|
||||
|
|
|
@ -134,8 +134,6 @@ pkg_check_modules(AWESOME_REQUIRED REQUIRED
|
|||
glib-2.0
|
||||
cairo
|
||||
x11
|
||||
pango>=1.19.3
|
||||
pangocairo>=1.19.3
|
||||
oocairo
|
||||
oopango
|
||||
xcb-randr
|
||||
|
|
78
font.c
78
font.c
|
@ -1,78 +0,0 @@
|
|||
/*
|
||||
* font.c - font functions
|
||||
*
|
||||
* Copyright © 2007-2009 Julien Danjou <julien@danjou.info>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <cairo/cairo-xcb.h>
|
||||
#include <pango/pangocairo.h>
|
||||
|
||||
#include "font.h"
|
||||
#include "screen.h"
|
||||
#include "globalconf.h"
|
||||
#include "common/xutil.h"
|
||||
|
||||
/** Create a new Pango font.
|
||||
* \param fontname Pango fontname (e.g. [FAMILY-LIST] [STYLE-OPTIONS] [SIZE]).
|
||||
* \return A new font.
|
||||
*/
|
||||
font_t *
|
||||
font_new(const char *fontname)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
cairo_t *cr;
|
||||
PangoLayout *layout;
|
||||
font_t *font = p_new(font_t, 1);
|
||||
|
||||
/* Create a dummy cairo surface, cairo context and pango layout in
|
||||
* order to get font informations */
|
||||
surface = cairo_xcb_surface_create(globalconf.connection,
|
||||
globalconf.default_screen,
|
||||
globalconf.visual, 1, 1);
|
||||
|
||||
cr = cairo_create(surface);
|
||||
layout = pango_cairo_create_layout(cr);
|
||||
|
||||
/* Get the font description used to set text on a PangoLayout */
|
||||
font->desc = pango_font_description_from_string(fontname);
|
||||
pango_layout_set_font_description(layout, font->desc);
|
||||
|
||||
/* Get height */
|
||||
pango_layout_get_pixel_size(layout, NULL, &font->height);
|
||||
|
||||
g_object_unref(layout);
|
||||
cairo_destroy(cr);
|
||||
cairo_surface_destroy(surface);
|
||||
|
||||
return font;
|
||||
}
|
||||
|
||||
/** Delete a font.
|
||||
* \param font Font to delete.
|
||||
*/
|
||||
void
|
||||
font_delete(font_t **font)
|
||||
{
|
||||
if(*font)
|
||||
{
|
||||
pango_font_description_free((*font)->desc);
|
||||
p_delete(font);
|
||||
}
|
||||
}
|
||||
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
37
font.h
37
font.h
|
@ -1,37 +0,0 @@
|
|||
/*
|
||||
* font.h - font functions header
|
||||
*
|
||||
* Copyright © 2009 Julien Danjou <julien@danjou.info>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AWESOME_FONT_H
|
||||
#define AWESOME_FONT_H
|
||||
|
||||
#include <pango/pango-font.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PangoFontDescription *desc;
|
||||
int height;
|
||||
} font_t;
|
||||
|
||||
font_t *font_new(const char *);
|
||||
void font_delete(font_t **);
|
||||
|
||||
#endif
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
|
@ -32,7 +32,6 @@
|
|||
|
||||
#include "objects/key.h"
|
||||
#include "color.h"
|
||||
#include "font.h"
|
||||
#include "common/xembed.h"
|
||||
|
||||
typedef struct drawin_t drawin_t;
|
||||
|
@ -75,8 +74,6 @@ typedef struct
|
|||
client_array_t stack;
|
||||
/** Lua VM state */
|
||||
lua_State *L;
|
||||
/** Default font */
|
||||
font_t *font;
|
||||
/** The event loop */
|
||||
struct ev_loop *loop;
|
||||
/** The key grabber function */
|
||||
|
|
33
luaa.c
33
luaa.c
|
@ -390,15 +390,7 @@ luaA_awesome_index(lua_State *L)
|
|||
|
||||
const char *buf = luaL_checkstring(L, 2);
|
||||
|
||||
if(a_strcmp(buf, "font") == 0)
|
||||
{
|
||||
char *font = pango_font_description_to_string(globalconf.font->desc);
|
||||
lua_pushstring(L, font);
|
||||
g_free(font);
|
||||
}
|
||||
else if(a_strcmp(buf, "font_height") == 0)
|
||||
lua_pushnumber(L, globalconf.font->height);
|
||||
else if(a_strcmp(buf, "conffile") == 0)
|
||||
if(a_strcmp(buf, "conffile") == 0)
|
||||
lua_pushstring(L, conffile);
|
||||
else if(a_strcmp(buf, "version") == 0)
|
||||
lua_pushliteral(L, AWESOME_VERSION);
|
||||
|
@ -410,28 +402,6 @@ luaA_awesome_index(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/** Newindex function for the awesome global table.
|
||||
* \param L The Lua VM state.
|
||||
* \return The number of elements pushed on stack.
|
||||
*/
|
||||
static int
|
||||
luaA_awesome_newindex(lua_State *L)
|
||||
{
|
||||
if(luaA_usemetatable(L, 1, 2))
|
||||
return 1;
|
||||
|
||||
const char *buf = luaL_checkstring(L, 2);
|
||||
|
||||
if(a_strcmp(buf, "font") == 0)
|
||||
{
|
||||
const char *newfont = luaL_checkstring(L, 3);
|
||||
font_delete(&globalconf.font);
|
||||
globalconf.font = font_new(newfont);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Add a global signal.
|
||||
* \param L The Lua VM state.
|
||||
* \return The number of elements pushed on stack.
|
||||
|
@ -532,7 +502,6 @@ luaA_init(xdgHandle* xdg)
|
|||
{ "emit_signal", luaA_awesome_emit_signal },
|
||||
{ "systray", luaA_systray },
|
||||
{ "__index", luaA_awesome_index },
|
||||
{ "__newindex", luaA_awesome_newindex },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue