Lines 64-69
Link Here
|
64 |
#include "ft2build.h" |
64 |
#include "ft2build.h" |
65 |
#include FT_FREETYPE_H |
65 |
#include FT_FREETYPE_H |
66 |
#include FT_TRUETYPE_TABLES_H |
66 |
#include FT_TRUETYPE_TABLES_H |
|
|
67 |
#include FT_TRUETYPE_TAGS_H |
67 |
#endif |
68 |
#endif |
68 |
|
69 |
|
69 |
#define DVI_STACK_DEPTH_MAX 256u |
70 |
#define DVI_STACK_DEPTH_MAX 256u |
Lines 1897-1902
Link Here
|
1897 |
pdf_dev_setcolor(&color, 0); /* stroke color */ |
1898 |
pdf_dev_setcolor(&color, 0); /* stroke color */ |
1898 |
pdf_dev_setcolor(&color, 1); /* fill color */ |
1899 |
pdf_dev_setcolor(&color, 1); /* fill color */ |
1899 |
} |
1900 |
} |
|
|
1901 |
|
1902 |
TT_HoriHeader *dir_hea; /* vhea structure is identical */ |
1903 |
FT_Error *error; |
1904 |
FT_Byte *buffer = NULL; |
1905 |
FT_ULong table_size = 0, offset; |
1906 |
if (FT_IS_SFNT(font->ft_face)) { |
1907 |
/* CFF driver of freetype does not set vertical metrics correctly, |
1908 |
so we'll read the metrics directly */ |
1909 |
dir_hea = FT_Get_Sfnt_Table(font->ft_face, (font->layout_dir == 0) |
1910 |
? ft_sfnt_hhea |
1911 |
: ft_sfnt_vhea); |
1912 |
error = FT_Load_Sfnt_Table(font->ft_face, |
1913 |
(font->layout_dir == 0) ? TTAG_hmtx : TTAG_vmtx, |
1914 |
0, NULL, &table_size); |
1915 |
if (!error) { |
1916 |
buffer = (FT_Byte *)calloc(table_size, 1); |
1917 |
/* Load the [hv]mtx table into buffer */ |
1918 |
FT_Load_Sfnt_Table(font->ft_face, |
1919 |
(font->layout_dir == 0) ? TTAG_hmtx : TTAG_vmtx, |
1920 |
0, buffer, &table_size); |
1921 |
} |
1922 |
} |
1923 |
|
1900 |
for (i = 0; i < slen; i++) { |
1924 |
for (i = 0; i < slen; i++) { |
1901 |
glyph_id = get_buffered_unsigned_pair(); /* freetype glyph index */ |
1925 |
glyph_id = get_buffered_unsigned_pair(); /* freetype glyph index */ |
1902 |
if (glyph_id < font->ft_face->num_glyphs) { |
1926 |
if (glyph_id < font->ft_face->num_glyphs) { |
Lines 1904-1920
Link Here
|
1904 |
if (FT_IS_SFNT(font->ft_face)) { |
1928 |
if (FT_IS_SFNT(font->ft_face)) { |
1905 |
/* CFF driver of freetype does not set vertical metrics correctly, |
1929 |
/* CFF driver of freetype does not set vertical metrics correctly, |
1906 |
so we'll read the metrics directly */ |
1930 |
so we'll read the metrics directly */ |
1907 |
TT_HoriHeader *dir_hea; /* vhea structure is identical */ |
1931 |
if (dir_hea && !error) { |
1908 |
dir_hea = FT_Get_Sfnt_Table(font->ft_face, (font->layout_dir == 0) |
1932 |
/* each metrics record is two shorts, advance and sidebearing |
1909 |
? ft_sfnt_hhea |
1933 |
* thus is 4-byte sized */ |
1910 |
: ft_sfnt_vhea); |
1934 |
offset = (glyph_id < dir_hea->number_Of_HMetrics) ? |
1911 |
if (dir_hea) { |
1935 |
4 * glyph_id : 4 * (dir_hea->number_Of_HMetrics - 1); |
1912 |
FT_UShort *metrics = (FT_UShort*) dir_hea->long_metrics; |
1936 |
if (offset + 4 > table_size) { |
1913 |
/* each metrics record is two shorts, advance and sidebearing */ |
1937 |
font->glyph_widths[glyph_id] = 0; |
1914 |
if (glyph_id < dir_hea->number_Of_HMetrics) |
1938 |
} else { |
1915 |
font->glyph_widths[glyph_id] = metrics[glyph_id * 2]; |
1939 |
font->glyph_widths[glyph_id] = |
1916 |
else |
1940 |
(FT_UShort)(buffer[offset] << 8 | buffer[offset + 1]); |
1917 |
font->glyph_widths[glyph_id] = metrics[2 * (dir_hea->number_Of_HMetrics - 1)]; |
1941 |
} |
1918 |
} else |
1942 |
} else |
1919 |
font->glyph_widths[glyph_id] = 0; |
1943 |
font->glyph_widths[glyph_id] = 0; |
1920 |
} |
1944 |
} |
Lines 1944-1949
Link Here
|
1944 |
} |
1968 |
} |
1945 |
RELEASE(xloc); |
1969 |
RELEASE(xloc); |
1946 |
RELEASE(yloc); |
1970 |
RELEASE(yloc); |
|
|
1971 |
free(buffer); |
1947 |
|
1972 |
|
1948 |
if (!dvi_state.d) { |
1973 |
if (!dvi_state.d) { |
1949 |
dvi_state.h += width; |
1974 |
dvi_state.h += width; |