external/afdko/UnpackedTarball_afdko.mk | 1 external/afdko/noverbose.patch | 56 ++++++++++++++++++++++++++++++++ vcl/source/gdi/embeddedfontsafdko.cxx | 36 ++++++++++++++++++-- 3 files changed, 90 insertions(+), 3 deletions(-)
New commits: commit b168aaf182b7ed80c06132f24bfe13790f443c3a Author: Caolán McNamara <[email protected]> AuthorDate: Wed Oct 22 13:43:02 2025 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Thu Oct 23 10:25:34 2025 +0200 suppress verbose output Change-Id: I56141b7ed0ca9b1885ad7bc39a40d7bb0a730d7c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192859 Reviewed-by: Szymon Kłos <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> diff --git a/external/afdko/UnpackedTarball_afdko.mk b/external/afdko/UnpackedTarball_afdko.mk index 0fe01b7a69b1..2985dc2f6b99 100644 --- a/external/afdko/UnpackedTarball_afdko.mk +++ b/external/afdko/UnpackedTarball_afdko.mk @@ -24,6 +24,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,afdko, \ external/afdko/extern_makeotf.patch \ external/afdko/warnings.patch \ external/afdko/mergeFonts_crash.patch \ + external/afdko/noverbose.patch \ external/afdko/antlr4-chrono.patch \ )) diff --git a/external/afdko/noverbose.patch b/external/afdko/noverbose.patch new file mode 100644 index 000000000000..4173d973dc67 --- /dev/null +++ b/external/afdko/noverbose.patch @@ -0,0 +1,56 @@ +--- afdko/c/mergefonts/source/mergeFonts.c 2025-10-22 13:47:13.840056699 +0100 ++++ afdko/c/mergefonts/source/mergeFonts.c 2025-10-22 13:48:02.496428544 +0100 +@@ -1727,7 +1727,9 @@ + for (j = 0; j < mergeInfo->newiFDArray.cnt; j++) { + if (curMaxFD < mergeInfo->newiFDArray.array[j]) { + curMaxFD = mergeInfo->newiFDArray.array[j]; +- fprintf(stderr, "Adding font dict %d from %s. ", curMaxFD, h->src.stm.filename); ++ if (h->flags & SHOW_NAMES) { ++ fprintf(stderr, "Adding font dict %d from %s. ", curMaxFD, h->src.stm.filename); ++ } + } + } + +--- afdko/c/makeotf/include/hotconv.h 2025-10-22 14:51:54.161381982 +0100 ++++ afdko/c/makeotf/include/hotconv.h 2025-10-22 14:57:50.948032645 +0100 +@@ -383,6 +383,7 @@ + #define HOT_SUBSET (1<<13) + #define HOT_SUPRESS__WIDTH_OPT (1<<14) /* suppress width optimization in CFF: makes it easier to poke at charstrings with other tools */ + #define HOT_VERBOSE (1<<15) /* Print all warnings and notes: else suppress the most annoying ones. */ ++#define HOT_SUPRESS_WARNINGS (1<<16) /* Print standard warnings and notes: else suppress the standard warnings. */ + + struct hotReadFontOverrides_ /* Record for instructions to modify font as it is read in. */ + { +--- afdko/c/makeotf/lib/hotconv/hot.c 2025-10-22 14:51:49.995353104 +0100 ++++ afdko/c/makeotf/lib/hotconv/hot.c 2025-10-22 14:56:10.084139451 +0100 +@@ -324,7 +324,9 @@ + + /* Convert to CFF */ + tcflags = 0; +- tcflags |= TC_DO_WARNINGS; ++ if (!(flags & HOT_SUPRESS_WARNINGS)) { ++ tcflags |= TC_DO_WARNINGS; ++ } + if (flags & HOT_ADD_AUTH_AREA) { + tcflags |= TC_ADDAUTHAREA; + } +@@ -385,7 +385,9 @@ + fi->FontName.length); + g->font.FontName.array[fi->FontName.length] = ' + g->font.FontName.cnt = fi->FontName.length + 1; +- hotMsg(g, hotHEADING, "processing font <%s>", g->font.FontName.array); ++ if (!(flags & HOT_SUPRESS_WARNINGS)) { ++ hotMsg(g, hotHEADING, "processing font <%s>", g->font.FontName.array); ++ } + + /* Copy basic font information */ + g->font.Notice = fi->Notice; +@@ -1444,7 +1444,7 @@ + /* Print note, error, warning, or fatal message (from note buffer is fmt is + NULL). If note used, handle reuse of g->note. */ + void CDECL hotMsg(hotCtx g, int level, const char *fmt, ...) { +- if (g->cb.message != NULL) { ++ if (g->cb.message != NULL && g->convertFlags & HOT_CONVERT_VERBOSE) { + // int lenName = g->font.FontName.cnt + 2; + + if (fmt == NULL) { diff --git a/vcl/source/gdi/embeddedfontsafdko.cxx b/vcl/source/gdi/embeddedfontsafdko.cxx index c067c6e2d10f..02cd0d6de05a 100644 --- a/vcl/source/gdi/embeddedfontsafdko.cxx +++ b/vcl/source/gdi/embeddedfontsafdko.cxx @@ -24,6 +24,8 @@ #include <vcl/embeddedfontsmanager.hxx> #include "afdko.hxx" +#define SUPERVERBOSE 0 + static bool convertTx(txCtx h) { h->src.stm.fp = fopen(h->src.stm.filename, "rb"); @@ -63,6 +65,23 @@ static bool convertTx(txCtx h) return true; } +static void suppressDebugMessagess(txCtx h) +{ +#if !SUPERVERBOSE + h->t1r.dbg.fp = nullptr; + h->cfr.dbg.fp = nullptr; + h->svr.dbg.fp = nullptr; + h->ufr.dbg.fp = nullptr; + h->ufow.dbg.fp = nullptr; + h->ttr.dbg.fp = nullptr; + h->cfw.dbg.fp = nullptr; + h->t1w.dbg.fp = nullptr; + h->svw.dbg.fp = nullptr; +#else + (void)h; +#endif +} + // System afdko could be used by calling: tx -dump src dest here bool EmbeddedFontsManager::tx_dump(const OUString& srcFontUrl, const OUString& destFileUrl) { @@ -78,6 +97,7 @@ bool EmbeddedFontsManager::tx_dump(const OUString& srcFontUrl, const OUString& d txCtx h = txNew(nullptr); if (!h) return false; + suppressDebugMessagess(h); OString srcFontPathA(srcFontPath.toUtf8()); OString destFilePathA(destFilePath.toUtf8()); @@ -106,6 +126,7 @@ bool EmbeddedFontsManager::tx_t1(const OUString& srcFontUrl, const OUString& des txCtx h = txNew(nullptr); if (!h) return false; + suppressDebugMessagess(h); setMode(h, mode_t1); @@ -152,6 +173,7 @@ bool EmbeddedFontsManager::mergefonts(const OUString& cidFontInfoUrl, const OUSt txCtx h = mergeFontsNew(nullptr); if (!h) return false; + suppressDebugMessagess(h); OString cidFontInfoPathA(cidFontInfoPath.toUtf8()); OString destFilePathA(destFilePath.toUtf8()); @@ -253,18 +275,26 @@ bool EmbeddedFontsManager::makeotf(const OUString& srcFontUrl, const OUString& d OString featuresPathA(featuresPath.toUtf8()); SAL_INFO( - "vcl.fonts", "makeotf -mf " + "vcl.fonts", "makeotf -nshw -mf " << fontMenuNameDBPathA << " -f " << srcFontPathA << " -o " << destFilePathA << (!charMapPathA.isEmpty() ? " -ch "_ostr + charMapPathA : OString()) << (!featuresPathA.isEmpty() ? " -ff "_ostr + featuresPathA : OString())); cbFCDBRead(cbctx, const_cast<char*>(fontMenuNameDBPathA.getStr())); - cbConvert(cbctx, HOT_NO_OLD_OPS, nullptr, const_cast<char*>(srcFontPathA.getStr()), + int flags = HOT_NO_OLD_OPS; + int fontConvertFlags = 0; +#if !SUPERVERBOSE + flags |= HOT_SUPRESS_WARNINGS | HOT_SUPRESS_HINT_WARNINGS; +#else + fontConvertFlags |= HOT_CONVERT_VERBOSE; +#endif + + cbConvert(cbctx, flags, nullptr, const_cast<char*>(srcFontPathA.getStr()), const_cast<char*>(destFilePathA.getStr()), !featuresPathA.isEmpty() ? const_cast<char*>(featuresPathA.getStr()) : nullptr, !charMapPathA.isEmpty() ? const_cast<char*>(charMapPathA.getStr()) : nullptr, nullptr, - nullptr, nullptr, 0, 0, 0, 0, 0, -1, -1, 0, nullptr); + nullptr, nullptr, fontConvertFlags, 0, 0, 0, 0, -1, -1, 0, nullptr); return true; }
