mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-01-03 09:44:24 +03:00
[project @ 2002-04-25 15:52:26 by bursa]
Interface to fonts. svn path=/import/netsurf/; revision=8
This commit is contained in:
parent
33dc126f53
commit
f5044a6d87
59
render/font.c
Normal file
59
render/font.c
Normal file
@ -0,0 +1,59 @@
|
||||
/**
|
||||
* $Id: font.c,v 1.1 2002/04/25 15:52:26 bursa Exp $
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "font.h"
|
||||
|
||||
/**
|
||||
* internal structures
|
||||
*/
|
||||
|
||||
struct font_set {
|
||||
/* a set of font handles */
|
||||
};
|
||||
|
||||
/**
|
||||
* functions
|
||||
*/
|
||||
|
||||
struct font_set * font_set_create(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
font_id font_add(struct font_set * font_set, const char * name, unsigned int weight,
|
||||
unsigned int size)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void font_set_free(struct font_set * font_set)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* find where to split some text to fit it in width
|
||||
*/
|
||||
|
||||
unsigned long font_split(struct font_set * font_set, font_id id, const char * text,
|
||||
unsigned long width, const char ** end)
|
||||
{
|
||||
size_t len = strlen(text);
|
||||
unsigned int i;
|
||||
assert(width >= 1);
|
||||
if (len <= width) {
|
||||
*end = text + len;
|
||||
return len;
|
||||
}
|
||||
/* invariant: no space in text[i+1..width) */
|
||||
for (i = width - 1; i != 0 && text[i] != ' '; i--)
|
||||
;
|
||||
*end = text + i;
|
||||
return i;
|
||||
}
|
||||
|
||||
|
22
render/font.h
Normal file
22
render/font.h
Normal file
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* $Id: font.h,v 1.1 2002/04/25 15:52:26 bursa Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
* structures and typedefs
|
||||
*/
|
||||
|
||||
struct font_set;
|
||||
typedef unsigned int font_id;
|
||||
|
||||
/**
|
||||
* interface
|
||||
*/
|
||||
|
||||
struct font_set * font_set_create(void);
|
||||
font_id font_add(struct font_set * font_set, const char * name, unsigned int weight,
|
||||
unsigned int size);
|
||||
void font_set_free(struct font_set * font_set);
|
||||
unsigned long font_split(struct font_set * font_set, font_id id, const char * text,
|
||||
unsigned long width, const char ** end);
|
||||
|
Loading…
Reference in New Issue
Block a user