forked from old/legacy-imlib2
parent
d7b8c1575b
commit
35b6638256
|
@ -1507,6 +1507,13 @@ font. The advances are not adjusted for rotation so you will have to translate
|
|||
the advances (which are calculated as if the text was drawn horizontally
|
||||
from left to right) depending on the text orientation.</blockquote>
|
||||
|
||||
<pre>
|
||||
<b><tt><font color="#660000"><font size=+2>int imlib_get_text_inset(const char *text);</font></font></tt></b></pre>
|
||||
|
||||
<blockquote>This function returns the inset of the first character of the
|
||||
text string passed in using the current font and returns that value in pixels.
|
||||
</blockquote>
|
||||
|
||||
<pre><b><tt><font color="#660000"><font size=+2>void imlib_add_path_to_font_path(const char *path);</font></font></tt></b></pre>
|
||||
|
||||
<blockquote>This function adds the directory path to the end of the current
|
||||
|
|
|
@ -267,6 +267,7 @@ extern "C"
|
|||
void imlib_get_text_advance(const char *text,
|
||||
int *horizontal_advance_return,
|
||||
int *vertical_advance_return);
|
||||
int imlib_get_text_inset(const char *text);
|
||||
void imlib_add_path_to_font_path(const char *path);
|
||||
void imlib_remove_path_from_font_path(const char *path);
|
||||
char **imlib_list_font_path(int *number_return);
|
||||
|
|
11
src/api.c
11
src/api.c
|
@ -1714,6 +1714,17 @@ void imlib_get_text_advance(const char *text,
|
|||
*vertical_advance_return = h;
|
||||
}
|
||||
|
||||
int imlib_get_text_inset(const char *text)
|
||||
{
|
||||
ImlibFont *fn;
|
||||
int w, h;
|
||||
|
||||
CHECK_PARAM_POINTER_RETURN("imlib_get_text_advance", "font", ctxt_font, 0);
|
||||
CHECK_PARAM_POINTER_RETURN("imlib_get_text_advance", "text", text, 0);
|
||||
fn = (ImlibFont *) ctxt_font;
|
||||
return __imlib_calc_inset(fn, text);
|
||||
}
|
||||
|
||||
void
|
||||
imlib_add_path_to_font_path(const char *path)
|
||||
{
|
||||
|
|
|
@ -77,7 +77,7 @@ __imlib_CmodReset(ImlibColorModifier *cm)
|
|||
|
||||
void
|
||||
__imlib_DataCmodApply(DATA32 *data, int w, int h, int jump,
|
||||
int *fl, ImlibColorModifier *cm)
|
||||
ImlibImageFlags *fl, ImlibColorModifier *cm)
|
||||
{
|
||||
int x, y;
|
||||
DATA32 *p;
|
||||
|
|
|
@ -1,6 +1,17 @@
|
|||
#ifndef __COLORMOD
|
||||
#define __COLORMOD 1
|
||||
|
||||
#include "common.h"
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include "image.h"
|
||||
|
||||
typedef struct _imlib_color_modifier ImlibColorModifier;
|
||||
|
||||
struct _imlib_color_modifier
|
||||
|
@ -48,7 +59,7 @@ void __imlib_CmodSetTables(ImlibColorModifier *cm, DATA8 *r,
|
|||
DATA8 *g, DATA8 *b, DATA8 *a);
|
||||
void __imlib_CmodReset(ImlibColorModifier *cm);
|
||||
void __imlib_DataCmodApply(DATA32 *data, int w, int h,
|
||||
int jump, int *fl,
|
||||
int jump, ImlibImageFlags *fl,
|
||||
ImlibColorModifier *cm);
|
||||
|
||||
void __imlib_CmodGetTables(ImlibColorModifier *cm, DATA8 *r,
|
||||
|
|
19
src/font.c
19
src/font.c
|
@ -408,6 +408,25 @@ __imlib_calc_advance(ImlibFont *f, int *adv_w, int *adv_h, const char *text)
|
|||
*adv_h = ph;
|
||||
}
|
||||
|
||||
int
|
||||
__imlib_calc_inset(ImlibFont *f, const char *text)
|
||||
{
|
||||
int i;
|
||||
TT_Glyph_Metrics gmetrics;
|
||||
|
||||
for (i = 0; text[i]; i++)
|
||||
{
|
||||
unsigned char j;
|
||||
|
||||
j = text[i];
|
||||
if (!TT_VALID(f->glyphs[j]))
|
||||
continue;
|
||||
TT_Get_Glyph_Metrics(f->glyphs[j], &gmetrics);
|
||||
return ((-gmetrics.bearingX) / 64);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
__imlib_render_str(ImlibImage *im, ImlibFont *fn, int drx, int dry, const char *text,
|
||||
DATA8 r, DATA8 g, DATA8 b, DATA8 a,
|
||||
|
|
|
@ -35,6 +35,7 @@ void __imlib_calc_size(ImlibFont *f, int *width, int *height,
|
|||
const char *text);
|
||||
void __imlib_calc_advance(ImlibFont *f, int *adv_w, int *adv_h,
|
||||
const char *text);
|
||||
int __imlib_calc_inset(ImlibFont *f, const char *text);
|
||||
void __imlib_render_str(ImlibImage *im, ImlibFont *fn, int drx,
|
||||
int dry, const char *text,
|
||||
DATA8 r, DATA8 g, DATA8 b, DATA8 a,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/extensions/XShm.h>
|
||||
#include "common.h"
|
||||
#include "colormod.h"
|
||||
|
@ -11,6 +12,7 @@
|
|||
#include "grab.h"
|
||||
#include "blend.h"
|
||||
#include "rend.h"
|
||||
#include "rotate.h"
|
||||
|
||||
/* size of the lines per segment we scale / render at a time */
|
||||
#define LINESIZE 16
|
||||
|
@ -354,11 +356,7 @@ __imlib_RenderImageSkewed(Display *d, ImlibImage *im, Drawable w, Drawable m,
|
|||
char dither_mask, ImlibColorModifier *cmod,
|
||||
ImlibOp op)
|
||||
{
|
||||
XImage *xim = NULL, *mxim = NULL;
|
||||
Context *ct;
|
||||
static GC gc = 0;
|
||||
static GC gcm = 0;
|
||||
XGCValues gcv;
|
||||
int dx1, dy1, dx2, dy2, dw, dh, tsx, tsy;
|
||||
ImlibImage *back;
|
||||
|
||||
|
|
Loading…
Reference in New Issue