doc/Makefile.am | 3 +++ doc/check-whitespace-in-args | 6 ++++++ doc/check-whitespace-in-args.py | 23 +++++++++++++++++++++++ doc/fccache.fncs | 6 +++--- doc/fccharset.fncs | 4 ++-- doc/fcfontset.fncs | 6 +++--- doc/fcpattern.fncs | 4 ++-- doc/fcrange.fncs | 8 ++++---- doc/fcstring.fncs | 6 +++--- doc/fcweight.fncs | 8 ++++---- doc/meson.build | 13 +++++++++++++ 11 files changed, 66 insertions(+), 21 deletions(-) New commits: commit 5a6fef681bfd27e6b733a48f3c43a5da042745a8 Merge: 60171c9 ae56188 Author: Akira TAGOH <akira@xxxxxxxxx> Date: Thu Apr 11 05:04:48 2024 +0000 Merge branch 'fix-doc' into 'main' doc: Fix a typo See merge request fontconfig/fontconfig!321 commit ae56188bcc3895acefddd7015c51e46c292236a7 Author: Akira TAGOH <akira@xxxxxxxxx> Date: Thu Apr 11 11:24:05 2024 +0900 doc: Fix a typo Also add some test script to avoid this situation. diff --git a/doc/Makefile.am b/doc/Makefile.am index a66420c..e6ec73a 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -67,6 +67,7 @@ SUFFIXES = \ $(NULL) TESTS = \ check-missing-doc \ + check-whitespace-in-args \ $(NULL) TESTS_ENVIRONMENT = \ top_srcdir=${top_srcdir}; export top_srcdir; \ @@ -140,6 +141,8 @@ noinst_SCRIPTS = \ ## check_SCRIPTS = \ check-missing-doc \ + check-whitespace-in-args \ + check-whitespace-in-args.py \ $(NULL) # man3_MANS = \ diff --git a/doc/check-whitespace-in-args b/doc/check-whitespace-in-args new file mode 100644 index 0000000..632ff1c --- /dev/null +++ b/doc/check-whitespace-in-args @@ -0,0 +1,6 @@ +#! /bin/sh + +set -e + +top_srcdir=${top_srcdir:-..} +${top_srcdir}/doc/check-whitespace-in-args.py ${top_srcdir}/doc diff --git a/doc/check-whitespace-in-args.py b/doc/check-whitespace-in-args.py new file mode 100755 index 0000000..0c4c2c1 --- /dev/null +++ b/doc/check-whitespace-in-args.py @@ -0,0 +1,23 @@ +#! /usr/bin/env python3 + +import argparse +import glob +import re +import sys +from pathlib import Path + +ret = 0 + +parser = argparse.ArgumentParser() +parser.add_argument('path') + +args = parser.parse_args() + +for fn in glob.glob(str(Path(args.path) / '*.fncs')): + with open(fn) as f: + for i, line in enumerate(f): + if re.search(r'[\w\[\]]+\s+@ARG', line, re.A): + ret = 1 + print("{file}:{line}\t{str}".format(file=fn, line=i+1, str=line.rstrip())) + +sys.exit(ret) diff --git a/doc/fccache.fncs b/doc/fccache.fncs index 7074b0f..512ff7a 100644 --- a/doc/fccache.fncs +++ b/doc/fccache.fncs @@ -41,7 +41,7 @@ from the cache are read-only. @RET@ const FcChar8 * @FUNC@ FcCacheSubdir @TYPE1@ const FcCache * @ARG1@ cache -@TYPE2@ int @ARG2@ i +@TYPE2@ int% @ARG2@ i @PURPOSE@ Return the <parameter>i</parameter>'th subdirectory. @DESC@ The set of subdirectories stored in a cache file are indexed by this @@ -70,7 +70,7 @@ FcCacheCopySet. @RET@ FcBool @FUNC@ FcDirCacheClean @TYPE1@ const FcChar8 * @ARG1@ cache_dir -@TYPE2@ FcBool @ARG2@ verbose +@TYPE2@ FcBool% @ARG2@ verbose @PURPOSE@ Clean up a cache directory @DESC@ This tries to clean up the cache directory of <parameter>cache_dir</parameter>. @@ -91,7 +91,7 @@ to <parameter>config</parameter>. @RET@ FcBool @FUNC@ FcDirCacheCreateUUID @TYPE1@ FcChar8 * @ARG1@ dir -@TYPE2@ FcBool @ARG2@ force +@TYPE2@ FcBool% @ARG2@ force @TYPE3@ FcConfig * @ARG3@ config @PURPOSE@ Create .uuid file at a directory @DESC@ diff --git a/doc/fccharset.fncs b/doc/fccharset.fncs index 40c8951..bc9fb62 100644 --- a/doc/fccharset.fncs +++ b/doc/fccharset.fncs @@ -220,8 +220,8 @@ code point for the page, or <constant>FC_CHARSET_DONE</constant> if @RET@ FcChar32 @FUNC@ FcCharSetCoverage @TYPE1@ const FcCharSet * @ARG1@ a -@TYPE2@ FcChar32 @ARG2@ page -@TYPE3@ FcChar32[8] @ARG3@ result +@TYPE2@ FcChar32% @ARG2@ page +@TYPE3@ FcChar32[8]% @ARG3@ result @PURPOSE@ DEPRECATED return coverage for a Unicode page @DESC@ DEPRECATED diff --git a/doc/fcfontset.fncs b/doc/fcfontset.fncs index 8297193..63f5415 100644 --- a/doc/fcfontset.fncs +++ b/doc/fcfontset.fncs @@ -53,7 +53,7 @@ inserted into the set (due to allocation failure). Otherwise returns FcTrue. @FUNC@ FcFontSetList @TYPE1@ FcConfig * @ARG1@ config @TYPE2@ FcFontSet ** @ARG2@ sets -@TYPE3@ int @ARG3@ nsets +@TYPE3@ int% @ARG3@ nsets @TYPE4@ FcPattern * @ARG4@ pattern @TYPE5@ FcObjectSet * @ARG5@ object_set @PURPOSE@ List fonts from a set of font sets @@ -70,7 +70,7 @@ to be up to date, and used. @FUNC@ FcFontSetMatch @TYPE1@ FcConfig * @ARG1@ config @TYPE2@ FcFontSet ** @ARG2@ sets -@TYPE3@ int @ARG3@ nsets +@TYPE3@ int% @ARG3@ nsets @TYPE4@ FcPattern * @ARG4@ pattern @TYPE5@ FcResult * @ARG5@ result @PURPOSE@ Return the best font from a set of font sets @@ -101,7 +101,7 @@ change at any time. @FUNC@ FcFontSetSort @TYPE1@ FcConfig * @ARG1@ config @TYPE2@ FcFontSet ** @ARG2@ sets -@TYPE3@ int @ARG3@ nsets +@TYPE3@ int% @ARG3@ nsets @TYPE4@ FcPattern * @ARG4@ pattern @TYPE5@ FcBool% @ARG5@ trim @TYPE6@ FcCharSet ** @ARG6@ csp diff --git a/doc/fcpattern.fncs b/doc/fcpattern.fncs index 0da3568..d32f3dc 100644 --- a/doc/fcpattern.fncs +++ b/doc/fcpattern.fncs @@ -181,7 +181,7 @@ values added to the list have binding <parameter>weak</parameter> instead of <pa @FUNC++++++@ FcPatternAddFTFace @TYPE1++++++@ FcPattern * @ARG1++++++@ p @TYPE2++++++@ const char * @ARG2++++++@ object -@TYPE3++++++@ const FT_Face @ARG3++++++@ f +@TYPE3++++++@ const FT_Face% @ARG3++++++@ f @PROTOTYPE+++++++@ @RET+++++++@ FcBool @@ -480,7 +480,7 @@ point to. if <parameter>iter</parameter> isn't valid, returns 0. @FUNC@ FcPatternIterGetValue @TYPE1@ const FcPattern * @ARG1@ p @TYPE2@ FcPatternIter * @ARG2@ iter -@TYPE3@ int @ARG3@ id +@TYPE3@ int% @ARG3@ id @TYPE4@ FcValue * @ARG4@ v @TYPE5@ FcValueBinding * @ARG5@ b @PURPOSE@ Returns a value which the iterator point to diff --git a/doc/fcrange.fncs b/doc/fcrange.fncs index c7232bf..6c6fe82 100644 --- a/doc/fcrange.fncs +++ b/doc/fcrange.fncs @@ -33,8 +33,8 @@ populates it with the contents of <parameter>range</parameter>. @RET@ FcRange * @FUNC@ FcRangeCreateDouble -@TYPE1@ double @ARG1@ begin -@TYPE2@ double @ARG2@ end +@TYPE1@ double% @ARG1@ begin +@TYPE2@ double% @ARG2@ end @PURPOSE@ create a range object for double @DESC@ <function>FcRangeCreateDouble</function> creates a new FcRange object with @@ -44,8 +44,8 @@ double sized value. @RET@ FcRange * @FUNC@ FcRangeCreateInteger -@TYPE1@ int @ARG1@ begin -@TYPE2@ int @ARG2@ end +@TYPE1@ int% @ARG1@ begin +@TYPE2@ int% @ARG2@ end @PURPOSE@ create a range object for integer @DESC@ <function>FcRangeCreateInteger</function> creates a new FcRange object with diff --git a/doc/fcstring.fncs b/doc/fcstring.fncs index 7be7697..c1d6baf 100644 --- a/doc/fcstring.fncs +++ b/doc/fcstring.fncs @@ -99,7 +99,7 @@ string. @RET@ FcBool @FUNC@ FcIsLower -@TYPE1@ FcChar8 @ARG1@ c +@TYPE1@ FcChar8% @ARG1@ c @PURPOSE@ check for lower case ASCII character @DESC@ This macro checks whether <parameter>c</parameter> is an lower case ASCII @@ -108,7 +108,7 @@ letter. @RET@ FcBool @FUNC@ FcIsUpper -@TYPE1@ FcChar8 @ARG1@ c +@TYPE1@ FcChar8% @ARG1@ c @PURPOSE@ check for upper case ASCII character @DESC@ This macro checks whether <parameter>c</parameter> is a upper case ASCII @@ -117,7 +117,7 @@ letter. @RET@ FcChar8 @FUNC@ FcToLower -@TYPE1@ FcChar8 @ARG1@ c +@TYPE1@ FcChar8% @ARG1@ c @PURPOSE@ convert upper case ASCII to lower case @DESC@ This macro converts upper case ASCII <parameter>c</parameter> to the diff --git a/doc/fcweight.fncs b/doc/fcweight.fncs index a3668d9..86229fe 100644 --- a/doc/fcweight.fncs +++ b/doc/fcweight.fncs @@ -21,7 +21,7 @@ */ @RET@ double @FUNC@ FcWeightFromOpenTypeDouble -@TYPE1@ double @ARG1@ ot_weight +@TYPE1@ double% @ARG1@ ot_weight @PURPOSE@ Convert from OpenType weight values to fontconfig ones @DESC@ <function>FcWeightFromOpenTypeDouble</function> returns an double value @@ -36,7 +36,7 @@ necessarily match any of the predefined constants. @RET@ double @FUNC@ FcWeightToOpenTypeDouble -@TYPE1@ double @ARG1@ ot_weight +@TYPE1@ double% @ARG1@ ot_weight @PURPOSE@ Convert from fontconfig weight values to OpenType ones @DESC@ <function>FcWeightToOpenTypeDouble</function> is the inverse of @@ -48,7 +48,7 @@ returns a number in the range 1 to 1000. @RET@ int @FUNC@ FcWeightFromOpenType -@TYPE1@ int @ARG1@ ot_weight +@TYPE1@ int% @ARG1@ ot_weight @PURPOSE@ Convert from OpenType weight values to fontconfig ones @DESC@ <function>FcWeightFromOpenType</function> is like @@ -59,7 +59,7 @@ Use the other function instead. @RET@ int @FUNC@ FcWeightToOpenType -@TYPE1@ int @ARG1@ ot_weight +@TYPE1@ int% @ARG1@ ot_weight @PURPOSE@ Convert from fontconfig weight values to OpenType ones @DESC@ <function>FcWeightToOpenType</function> is like diff --git a/doc/meson.build b/doc/meson.build index e7b6b07..290549c 100644 --- a/doc/meson.build +++ b/doc/meson.build @@ -1,4 +1,12 @@ doc_targets = [] +tests = [] + +if host_machine.system() != 'windows' + tests += [ + 'check-missing-doc', + 'check-whitespace-in-args' + ] +endif docbook2man = find_program('docbook2man', required: get_option('doc-man')) docbook2txt = find_program('docbook2txt', required: get_option('doc-txt')) @@ -170,3 +178,8 @@ if docbook2html.found() install_dir: get_option('datadir') / 'doc' / 'fontconfig', install: true) endif + +foreach script : tests + py = find_program(script) + test(script, py) +endforeach