summaryrefslogtreecommitdiff
path: root/vcl/source/font
AgeCommit message (Collapse)Author
2022-11-18rename IsStarSymbol to IsOpenSymbolCaolán McNamara
Change-Id: If525ba9826f5bc2d860233cbabf58d1d290be054 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142936 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-11-11Drop a counterproductive top-level constStephan Bergmann
...that was apparently left by accident by caa10a1f80da856debf4f397503f27c86199208f "vcl: Use a hb_face_t wrapper in TrueTypeFace", thwarting the use of std::move here. (I came across this code with an upcoming loplugin:constmove that flags suspicious uses of std::move involving const-qualified types.) Change-Id: I460b11738b0f480a91c1212632cb428cb1331cd6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142560 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-11-08Related: ofz#47699 ludicrous font heightCaolán McNamara
Change-Id: Ief06eda35445d403c163a59038c694138465f698 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142456 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-11-02vcl: add PhysicalFontFace::GetVariations()Khaled Hosny
Use it to set the variations on hb_font_t, and we will use it for other things in later commits. Change-Id: Iae1861f74b38af4921ac97c1facecf0d4815c201 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142024 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-10-01Unused constantsKhaled Hosny
Change-Id: Ic43a4e52b5ea40e54b368815e504840cb2c78aab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140845 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-10-01vcl: Use PhysicalFontFace::GetRawFontData() for font embeddingKhaled Hosny
Change-Id: I6f7c4508f7cef022eaf65a998cb242078d3771c6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140826 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-10-01vcl: Use a hb_face_t wrapper in TrueTypeFaceKhaled Hosny
We don’t need full access to PhysicalFontFace. This will be needed when we use hb-subset API for instantiating variable fonts. Change-Id: I2578525cd54167d01cd2748d5ac1900c607867a1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140823 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-10-01Fix typoAndrea Gelmini
Change-Id: Ice3068f3b20c0f8a20e8b3c05ddf358b971f66ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140810 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2022-10-01Fix typoAndrea Gelmini
Change-Id: Ib547189e0f87f3e3a3096dd587127706474983cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140809 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2022-10-01vcl: Move TrueTypeFace where it is usedKhaled Hosny
No need to make it module public. Easier to modify it. Change-Id: I119381d463c8f176b355fc7df111011ae518b49d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140821 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-30vcl: Use LogicalFontInstance::GetScale()Khaled Hosny
Change-Id: I5f79fddd4e514c8224446e2327528002e9daa566 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140808 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-30vcl: Use the same underline sizes for overlinesKhaled Hosny
It makes no since to have overline of different sizes than underlines, and in fonts with big ascenders (like Amiri), we end up calculating much thicker overline than underline. Change-Id: I97e9818c94e815b2eb57813ab22329bc833fd34c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140804 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-30vcl: Use font’s underline/strike position and sizeKhaled Hosny
This respects the values set by font designer, which are usually better than the values we calculate especially for fonts with deep descenders (like Amiri). Old code is kept as fallback in case the font does not provide such values. Change-Id: I51a5147e4c6e006d1dcd13817ed21f0f62b47e97 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140803 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-30vcl: Apply variations to font metricsKhaled Hosny
Use HarfBuzz API instead of reading the raw font table directly, since HarfBuzz will apply the font variations as needed. For non-variable fonts we still also use HarfBuzz font metrics API, but in a more fine-grained way to maintain backward-compatibility. Change-Id: If6b12a11ecb63356be92ef4f0714355ae77378f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140799 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-23vcl: Use glyph names from the font in Type 3 fontsKhaled Hosny
Some PDF viewers might use glyph names to guess corresponding character, and it also makes debugging the PDF output a little bit easier. Change-Id: Ibe7f28d10814a9deb467129c85fed914fb7b3f9f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140465 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-23vcl: tdf#121327 PDF export for bitmap color fontsKhaled Hosny
This change extracts the PNG data from the sbix/CBDT tables and embeds them as PDF Type 3 glyphs. In case the font supports both color layers and color bitmaps, the color layer take priority. This also reverts the part of the following commit that allowed bitmap fonts when creating font subsets because this is not needed now as the such fonts will now not reach the subsetting code. commit dcf7792da2aa2a1ef774a124f7b21f68fff0fd15 Author: Khaled Hosny <khaledhosny@eglug.org> Date: Tue Aug 27 15:19:15 2019 +0200 Make Noto Color Emoji font work on Linux Change-Id: I350ec97956f37ae574956b22712869fd6d1a6990 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140457 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-21use more string_view in vclNoel Grandin
Change-Id: I66f96a305bb095716023ae1e565950971826bce0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140242 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-09-20use O[U]String in TrueType codeNoel Grandin
instead of manual memory management Change-Id: Iccde191bfcfbf9ff2488205fffc12b94b46ab658 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140207 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-09-20vcl: tdf#138325 pass PostScript name down to CreateCFFfontSubset()Khaled Hosny
If we don’t pass the name from the caller, it will try to read it from the CFF table but some fonts has CFF table without a PostScript name so we end up with a dummy value. Change-Id: Ie7c46cdf5542ce83a57b60dee35dbb704a898f18 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140220 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-20vcl: Add PhysicalFontFace::GetName()Khaled Hosny
Change-Id: I91cc7bd0b9c9ce8d59a31d17a354fb3f2be29499 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140219 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-19vcl: Fix Type 3 glyph widthsKhaled Hosny
It seems we need the values to be in unscaled font units not PS units. Modify LogicalFontInstance::GetGlyphWidth() to return unscaled values when requested and the TT-to-PS conversion conditionally in PDFWriter. Change-Id: I94e7cdc0ecf842a0cf87fddaa4467966f698ae3d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140126 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-19vcl: Add PhysicalFontFace::UnitsPerEm()Khaled Hosny
Change-Id: I9239085aabe450499193e74ac91d6a16437545c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140124 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-19vcl: Add PhysicalFontFace API to get color layersKhaled Hosny
Change-Id: Ic221582a04982f0b1565089fa0beff1b34a749d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140123 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-19vcl: Don’t use temporary files for CreateFontSubset()Khaled Hosny
The callers pass a path to a temporary file for the function to write to, then they immediately read from it. This change cuts the unnecessary use of temporary files and passes the subset font data around instead. The CFF subsetting code really wants files and needs more invasive change, so it still uses a temporary files but this is hidden from its caller. Change-Id: I2a2117e967b76fb903ff0d32c435925049bc6e56 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140122 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-13vcl: Simplify calling FillFontSubsetInfo()Khaled Hosny
Change-Id: I725ad2f3dcdbe032c0a36d9649a2ed85a499a20a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139800 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-13vcl: Move subsetting helper functions to sft.cxxKhaled Hosny
No functional change. Change-Id: I8de9117c1b1b1fef251e2711287dbdadaccc4d74 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139799 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-11vcl: Move CreateFontSubset() to PhysicalFontFaceKhaled Hosny
Having it in SalGraphics is not necessary as the code now depends on PhysicalFontFace for accessing raw font data, and this consolidates all the near identical copies of this code into one. Change-Id: I8a411f102fd2188a456bdeb8a0d794078d74e47b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139762 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-11vcl: Add PhysicalFontFace::GetRawFontData()Khaled Hosny
Change-Id: Iddeccfc8ffd5e63f7df09219ac4507502011fb28 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139626 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-10Fix typoAndrea Gelmini
Change-Id: Id6008749a90116f6826e624645dbab23288fe810 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139606 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2022-09-10vcl: Use vector instead of array for FontCharMap rangesKhaled Hosny
Change-Id: I8846c89d51cc33022f90c3a9c03bc1560497e651 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139701 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-09ofz: Undefined-shiftCaolán McNamara
Change-Id: Ida81135280ff61c3a8e96e8f5ed977959e169f61 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139716 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-09-08vcl: Drop CmapResult indirectionKhaled Hosny
Change-Id: I3b1beb5e976a255ef8ecdf8670b1e59547ec5ea4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139700 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-08vcl: Drop now unused ParseCMAP()Khaled Hosny
Change-Id: I2140b7b48ee4cc46a4a6e8e4719f3ce78a600829 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139624 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-08vcl: Get FontCharMap from HarfBuzzKhaled Hosny
Implement PhysicalFontFace::GetFontCharMap() on top hb_face_collect_unicodes() so that it is the same charmap as what shaping code will actually use. Change-Id: I486e9d296cec5bd897e4f628d14a2f19e63b70b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139623 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-08vcl: Drop now unused FontCharMap::GetGlyphIndex()Khaled Hosny
Change-Id: Icf687d09c2d25a3d578faf7ae574b3e655b8540f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139600 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-08vcl: Add LogicalFontInstance::GetGlyphIndex()Khaled Hosny
And use it in a few places, particularly where we get glyph ID from FontCharMap. We want to get the glyph indices from HarfBuzz like we do for shaping, to avoid any potential discrepancy (e.g. a new “cmap” subtable that our ParseCMAP() would not automatically support). Change-Id: Ie80993b35f0586d8567b6bda0ea56ba453316e81 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139578 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-07vcl: convert ImplGetEmphasisMark() to EmphasisMark classChris Sherlock
It makes more sense for an emphasis mark to be an object that can be queried, than it is for it to be a function with lots of output parameters. I have added a unit test, note that for now something doesn't seem right with polypolygon equality checks (test fails, but the disc is generated the same way) so not testing the shape creation. Change-Id: I7597603419b69639b8d9764afdb68e266da7a56b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122601 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-09-06vcl: Add LogicalFontInstance::GetGlyphWidth()Khaled Hosny
To be used it in PDF export where we need the unshaped glyph width to calculate PDF glyph adjustments. Getting the advances from HarfBuzz instead of reading them font the font makes sure we are always getting the correct values (e.g. when using variable fonts, though we still don’t correctly embed them in PDF). Change-Id: I91365a1580d3848c2f93044adcb366fd01173155 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139462 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-06Missing initialization of PhysicalFontFace::mbFontCapabilitiesReadStephan Bergmann
Regression introduced with 28c8cddd4218905bca05778dcdbae5911132a096 "vcl: Consolidate PhysicalFontFace::GetFontCapabilities()", causing > vcl/source/font/PhysicalFontFace.cxx:252:10: runtime error: load of value 190, which is not a valid value for type 'bool' > #0 in vcl::font::PhysicalFontFace::GetFontCapabilities(vcl::FontCapabilities&) const at vcl/source/font/PhysicalFontFace.cxx:252:10 > #1 in FreeTypeTextRenderImpl::GetFontCapabilities(vcl::FontCapabilities&) const at vcl/unx/generic/gdi/freetypetextrender.cxx:83:46 > #2 in SvpSalGraphics::GetFontCapabilities(vcl::FontCapabilities&) const at vcl/headless/svptext.cxx:46:30 > #3 in OutputDevice::GetFontCapabilities(vcl::FontCapabilities&) const at vcl/source/outdev/font.cxx:262:24 > #4 in makeShortRepresentativeTextForSelectedFont(OutputDevice const&) at svtools/source/misc/sampletext.cxx:1255:22 > #5 in DrawPreview(FontMetric const&, Point const&, OutputDevice&, bool) at svtools/source/control/ctrlbox.cxx:634:27 > #6 in FontNameBox::CachePreview(unsigned long, Point*) at svtools/source/control/ctrlbox.cxx:785:9 > #7 in FontNameBox::UpdateHdl(Timer*) at svtools/source/control/ctrlbox.cxx:564:5 > #8 in FontNameBox::LinkStubUpdateHdl(void*, Timer*) at svtools/source/control/ctrlbox.cxx:562:1 > #9 in Link<Timer*, void>::Call(Timer*) const at include/tools/link.hxx:111:45 during CppunitTest_toolkit_a11y. Change-Id: I3591c4722410a8c6d1ae539f71a3d8ac37a4d3a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139464 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-09-06Revert "vcl: Add LogicalFontInstance::GetUnscaledGLyphWidth()"خالد حسني
This reverts commit fa1835db77b38047d8c3cea7041d38762c329867. Reason for revert: merged too early Change-Id: I7dba2e8fcc06db59b2cbc211a0f4e7d1f209aa05 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139428 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-05vcl: Add LogicalFontInstance::GetUnscaledGLyphWidth()Khaled Hosny
To get glyph width in font units (i.e. scaled at font units per EM), and use it in PDF export. First step towards dropping SalGraphics::GetGlyphWidths(). Change-Id: Ic0ef165e8aed6f94caf68bf01ef7ecc0620ce7c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139448 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-05vcl: fontinstance.{cxx,hxx} -> LogicalFontInstance.{cxx,hxx}Khaled Hosny
Every time I need this file, I had to lookup the file name and location. Rename it following the pattern of other font classes and move the header next to their headers. Change-Id: Ia1e3ee4be9375c1110e169c593e1f8e7aad39c76 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139446 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-05vcl: Consolidate PhysicalFontFace::GetFontCapabilities()Khaled Hosny
All subclasses are doing the same thing in slightly different ways, so move it to the base class that we can now access font tables there. Change-Id: I1f8827dbc345aa852e1f7aaaa4cb4615593289c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139395 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-05vcl: Format PhysicalFontFace.{cxx,hxx}Khaled Hosny
They are small files, lets format before adding more code. Change-Id: I5e8e7e4031f045cf6e124dd533e37ab67f34e985 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139394 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-05vcl: Consolidate PhysicalFontFace::GetFontCharMap()Khaled Hosny
All subclasses are doing the same thing in slightly different ways, so move it to the base class that we can now access font tables there. Also drop unused PhysicalFontFace::HasChar(). Change-Id: I77022b4dc3688de2788c18966f39f407a6abb730 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139340 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-04vcl: Create hb_face_t in PhysicalFontFaceKhaled Hosny
The two map to each other, and we want to access hb_face_t to provide some functionality scattered currently in platform-specific implementations. Change-Id: Ib3842752ec240b8254db828dba95a6a0ad65f16a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139275 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-01FeatureCollector: check for alternates only in GSUBKhaled Hosny
hb_ot_layout_lookup_get_glyph_alternates() does not take a table ta and GSUB table is assumed, but if we are checking GPOS table then we will passing a lookup index from a different table and the result will be garbage (e.g. think Inter’s kern feature has 8 alternate glyphs). Change-Id: I78d5eb8304aee3321f492d15e3fc10db47cdc628 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139138 Tested-by: خالد حسني <khaled@aliftype.com> Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-08-27vcl: Don’t leak hb_set_tKhaled Hosny
Looks like I have a habit of never destroying these. Change-Id: I58e77908c68553222e34600aafb6fee186000a0b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138893 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-08-26FeatureCollector: Drop redundant checkKhaled Hosny
HarfBuzz handles this for us, and it more future-proof this way. Change-Id: Ia8a65f0363a05c74a718a1a9f7d6df6c84373f46 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138853 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-08-25FeatureCollector: Fix parameter code for named parametersKhaled Hosny
The code are 1-indexed (since 0 means disabled). Change-Id: I1d4ed80ba91191645305aadbbbb2d621116c5d36 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138842 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>