mirror of
https://github.com/michaelrsweet/pdfio.git
synced 2024-12-26 13:28:22 +01:00
Merge TTF changes to fix off-by-one error.
This commit is contained in:
parent
19c45871fa
commit
59959bf0e5
9
ttf.c
9
ttf.c
@ -3,16 +3,12 @@
|
|||||||
//
|
//
|
||||||
// https://github.com/michaelrsweet/ttf
|
// https://github.com/michaelrsweet/ttf
|
||||||
//
|
//
|
||||||
// Copyright © 2018-2021 by Michael R Sweet.
|
// Copyright © 2018-2023 by Michael R Sweet.
|
||||||
//
|
//
|
||||||
// Licensed under Apache License v2.0. See the file "LICENSE" for more
|
// Licensed under Apache License v2.0. See the file "LICENSE" for more
|
||||||
// information.
|
// information.
|
||||||
//
|
//
|
||||||
|
|
||||||
//
|
|
||||||
// Include necessary headers...
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# define _CRT_SECURE_NO_WARNINGS
|
# define _CRT_SECURE_NO_WARNINGS
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
@ -691,6 +687,9 @@ ttfGetExtents(
|
|||||||
ch = *s++;
|
ch = *s++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Issue #1: Offset past ".notdef"...
|
||||||
|
ch ++;
|
||||||
|
|
||||||
// Find its width...
|
// Find its width...
|
||||||
if ((widths = font->widths[ch / 256]) != NULL)
|
if ((widths = font->widths[ch / 256]) != NULL)
|
||||||
{
|
{
|
||||||
|
13
ttf.h
13
ttf.h
@ -3,7 +3,7 @@
|
|||||||
//
|
//
|
||||||
// https://github.com/michaelrsweet/ttf
|
// https://github.com/michaelrsweet/ttf
|
||||||
//
|
//
|
||||||
// Copyright © 2018-2021 by Michael R Sweet.
|
// Copyright © 2018-2023 by Michael R Sweet.
|
||||||
//
|
//
|
||||||
// Licensed under Apache License v2.0. See the file "LICENSE" for more
|
// Licensed under Apache License v2.0. See the file "LICENSE" for more
|
||||||
// information.
|
// information.
|
||||||
@ -11,17 +11,11 @@
|
|||||||
|
|
||||||
#ifndef TTF_H
|
#ifndef TTF_H
|
||||||
# define TTF_H
|
# define TTF_H
|
||||||
|
|
||||||
//
|
|
||||||
// Include necessary headers...
|
|
||||||
//
|
|
||||||
|
|
||||||
# include <stdbool.h>
|
# include <stdbool.h>
|
||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
|
|
||||||
# ifdef __cplusplus
|
# ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
# endif //
|
# endif // __cplusplus
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -89,8 +83,8 @@ extern ttf_t *ttfCreate(const char *filename, size_t idx, ttf_err_cb_t err_cb,
|
|||||||
extern void ttfDelete(ttf_t *font);
|
extern void ttfDelete(ttf_t *font);
|
||||||
extern int ttfGetAscent(ttf_t *font);
|
extern int ttfGetAscent(ttf_t *font);
|
||||||
extern ttf_rect_t *ttfGetBounds(ttf_t *font, ttf_rect_t *bounds);
|
extern ttf_rect_t *ttfGetBounds(ttf_t *font, ttf_rect_t *bounds);
|
||||||
extern int ttfGetCapHeight(ttf_t *font);
|
|
||||||
extern const int *ttfGetCMap(ttf_t *font, size_t *num_cmap);
|
extern const int *ttfGetCMap(ttf_t *font, size_t *num_cmap);
|
||||||
|
extern int ttfGetCapHeight(ttf_t *font);
|
||||||
extern const char *ttfGetCopyright(ttf_t *font);
|
extern const char *ttfGetCopyright(ttf_t *font);
|
||||||
extern int ttfGetDescent(ttf_t *font);
|
extern int ttfGetDescent(ttf_t *font);
|
||||||
extern ttf_rect_t *ttfGetExtents(ttf_t *font, float size, const char *s, ttf_rect_t *extents);
|
extern ttf_rect_t *ttfGetExtents(ttf_t *font, float size, const char *s, ttf_rect_t *extents);
|
||||||
@ -112,5 +106,4 @@ extern bool ttfIsFixedPitch(ttf_t *font);
|
|||||||
# ifdef __cplusplus
|
# ifdef __cplusplus
|
||||||
}
|
}
|
||||||
# endif // __cplusplus
|
# endif // __cplusplus
|
||||||
|
|
||||||
#endif // !TTF_H
|
#endif // !TTF_H
|
||||||
|
Loading…
Reference in New Issue
Block a user