summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/freetype/src/tools/docmaker
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2018-12-10 14:59:49 +0100
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2019-01-31 10:40:41 +0000
commit02280535bea08395871722f733aaaed70c992260 (patch)
tree8ff7fd6a26710645d18887fad6299ae7debfded1 /src/3rdparty/freetype/src/tools/docmaker
parent93a803a6de27d9eb57931c431b5f3d074914f693 (diff)
Update bundled Freetype to 2.9.1
This is required to support the new emoji font on Android 9. [ChangeLog][Freetype] Upgraded bundled Freetype version to 2.9.1. This also adds support for the latest emoji font in use on Android 9. Fixes: QTBUG-70657 Change-Id: I99be72f0d23c20aca122b8fdadd4ded87b2edce1 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Diffstat (limited to 'src/3rdparty/freetype/src/tools/docmaker')
-rw-r--r--src/3rdparty/freetype/src/tools/docmaker/content.py66
-rw-r--r--src/3rdparty/freetype/src/tools/docmaker/docbeauty.py18
-rw-r--r--src/3rdparty/freetype/src/tools/docmaker/docmaker.py26
-rw-r--r--src/3rdparty/freetype/src/tools/docmaker/formatter.py7
-rw-r--r--src/3rdparty/freetype/src/tools/docmaker/sources.py34
-rw-r--r--src/3rdparty/freetype/src/tools/docmaker/tohtml.py184
-rw-r--r--src/3rdparty/freetype/src/tools/docmaker/utils.py2
7 files changed, 218 insertions, 119 deletions
diff --git a/src/3rdparty/freetype/src/tools/docmaker/content.py b/src/3rdparty/freetype/src/tools/docmaker/content.py
index 1961878a7d..198780aee4 100644
--- a/src/3rdparty/freetype/src/tools/docmaker/content.py
+++ b/src/3rdparty/freetype/src/tools/docmaker/content.py
@@ -3,7 +3,7 @@
#
# Parse comment blocks to build content blocks (library file).
#
-# Copyright 2002-2015 by
+# Copyright 2002-2018 by
# David Turner.
#
# This file is part of the FreeType project, and may only be used,
@@ -46,9 +46,26 @@ re_code_end = re.compile( r"(\s*)}\s*$" )
#
-# A regular expression to isolate identifiers from other text.
+# A regular expression to isolate identifiers from other text. Two syntax
+# forms are supported:
#
-re_identifier = re.compile( r'((?:\w|-)*)' )
+# <name>
+# <name>[<id>]
+#
+# where both `<name>' and `<id>' consist of alphanumeric characters, `_',
+# and `-'. Use `<id>' if there are multiple, valid `<name>' entries; in the
+# index, `<id>' will be appended in parentheses.
+#
+# For example,
+#
+# stem_darkening[autofit]
+#
+# becomes `stem_darkening (autofit)' in the index.
+#
+re_identifier = re.compile( r"""
+ ((?:\w|-)+
+ (?:\[(?:\w|-)+\])?)
+ """, re.VERBOSE )
#
@@ -92,7 +109,7 @@ class DocCode:
def dump( self, prefix = "", width = 60 ):
lines = self.dump_lines( 0, width )
for l in lines:
- print prefix + l
+ print( prefix + l )
def dump_lines( self, margin = 0, width = 60 ):
result = []
@@ -122,7 +139,7 @@ class DocPara:
def dump( self, prefix = "", width = 60 ):
lines = self.dump_lines( 0, width )
for l in lines:
- print prefix + l
+ print( prefix + l )
def dump_lines( self, margin = 0, width = 60 ):
cur = "" # current line
@@ -226,13 +243,13 @@ class DocField:
def dump( self, prefix = "" ):
if self.field:
- print prefix + self.field + " ::"
+ print( prefix + self.field + " ::" )
prefix = prefix + "----"
first = 1
for p in self.items:
if not first:
- print ""
+ print( "" )
p.dump( prefix )
first = 0
@@ -313,10 +330,10 @@ class DocMarkup:
return None
def dump( self, margin ):
- print " " * margin + "<" + self.tag + ">"
+ print( " " * margin + "<" + self.tag + ">" )
for f in self.fields:
f.dump( " " )
- print " " * margin + "</" + self.tag + ">"
+ print( " " * margin + "</" + self.tag + ">" )
################################################################
@@ -436,15 +453,32 @@ class ContentProcessor:
markup_lines = []
first = 1
+ margin = -1
+ in_code = 0
+
for line in content:
- found = None
- for t in re_markup_tags:
- m = t.match( line )
+ if in_code:
+ m = re_code_end.match( line )
+ if m and len( m.group( 1 ) ) <= margin:
+ in_code = 0
+ margin = -1
+ else:
+ m = re_code_start.match( line )
if m:
- found = string.lower( m.group( 1 ) )
- prefix = len( m.group( 0 ) )
- line = " " * prefix + line[prefix:] # remove markup from line
- break
+ in_code = 1
+ margin = len( m.group( 1 ) )
+
+ found = None
+
+ if not in_code:
+ for t in re_markup_tags:
+ m = t.match( line )
+ if m:
+ found = string.lower( m.group( 1 ) )
+ prefix = len( m.group( 0 ) )
+ # remove markup from line
+ line = " " * prefix + line[prefix:]
+ break
# is it the start of a new markup section ?
if found:
diff --git a/src/3rdparty/freetype/src/tools/docmaker/docbeauty.py b/src/3rdparty/freetype/src/tools/docmaker/docbeauty.py
index 3ddf4a94a1..0b021fa6c9 100644
--- a/src/3rdparty/freetype/src/tools/docmaker/docbeauty.py
+++ b/src/3rdparty/freetype/src/tools/docmaker/docbeauty.py
@@ -10,9 +10,7 @@ from sources import *
from content import *
from utils import *
-import utils
-
-import sys, os, time, string, getopt
+import sys, os, string, getopt
content_processor = ContentProcessor()
@@ -40,13 +38,13 @@ def beautify_block( block ):
def usage():
- print "\nDocBeauty 0.1 Usage information\n"
- print " docbeauty [options] file1 [file2 ...]\n"
- print "using the following options:\n"
- print " -h : print this page"
- print " -b : backup original files with the 'orig' extension"
- print ""
- print " --backup : same as -b"
+ print( "\nDocBeauty 0.1 Usage information\n" )
+ print( " docbeauty [options] file1 [file2 ...]\n" )
+ print( "using the following options:\n" )
+ print( " -h : print this page" )
+ print( " -b : backup original files with the 'orig' extension" )
+ print( "" )
+ print( " --backup : same as -b" )
def main( argv ):
diff --git a/src/3rdparty/freetype/src/tools/docmaker/docmaker.py b/src/3rdparty/freetype/src/tools/docmaker/docmaker.py
index de82d930f5..eb49afb0a0 100644
--- a/src/3rdparty/freetype/src/tools/docmaker/docmaker.py
+++ b/src/3rdparty/freetype/src/tools/docmaker/docmaker.py
@@ -4,7 +4,7 @@
#
# Convert source code markup to HTML documentation.
#
-# Copyright 2002-2015 by
+# Copyright 2002-2018 by
# David Turner.
#
# This file is part of the FreeType project, and may only be used,
@@ -31,21 +31,21 @@ from tohtml import *
import utils
-import sys, os, time, string, glob, getopt
+import sys, glob, getopt
def usage():
- print "\nDocMaker Usage information\n"
- print " docmaker [options] file1 [file2 ...]\n"
- print "using the following options:\n"
- print " -h : print this page"
- print " -t : set project title, as in '-t \"My Project\"'"
- print " -o : set output directory, as in '-o mydir'"
- print " -p : set documentation prefix, as in '-p ft2'"
- print ""
- print " --title : same as -t, as in '--title=\"My Project\"'"
- print " --output : same as -o, as in '--output=mydir'"
- print " --prefix : same as -p, as in '--prefix=ft2'"
+ print( "\nDocMaker Usage information\n" )
+ print( " docmaker [options] file1 [file2 ...]\n" )
+ print( "using the following options:\n" )
+ print( " -h : print this page" )
+ print( " -t : set project title, as in '-t \"My Project\"'" )
+ print( " -o : set output directory, as in '-o mydir'" )
+ print( " -p : set documentation prefix, as in '-p ft2'" )
+ print( "" )
+ print( " --title : same as -t, as in '--title=\"My Project\"'" )
+ print( " --output : same as -o, as in '--output=mydir'" )
+ print( " --prefix : same as -p, as in '--prefix=ft2'" )
def main( argv ):
diff --git a/src/3rdparty/freetype/src/tools/docmaker/formatter.py b/src/3rdparty/freetype/src/tools/docmaker/formatter.py
index f0a8808c47..2708fd40d6 100644
--- a/src/3rdparty/freetype/src/tools/docmaker/formatter.py
+++ b/src/3rdparty/freetype/src/tools/docmaker/formatter.py
@@ -3,7 +3,7 @@
#
# Convert parsed content blocks to a structured document (library file).
#
-# Copyright 2002-2015 by
+# Copyright 2002-2018 by
# David Turner.
#
# This file is part of the FreeType project, and may only be used,
@@ -56,6 +56,11 @@ class Formatter:
self.block_index = self.identifiers.keys()
self.block_index.sort( key = index_key )
+ # also add section names to dictionary (without making them appear
+ # in the index)
+ for section in self.sections:
+ self.add_identifier( section.name, section )
+
def add_identifier( self, name, block ):
if name in self.identifiers:
# duplicate name!
diff --git a/src/3rdparty/freetype/src/tools/docmaker/sources.py b/src/3rdparty/freetype/src/tools/docmaker/sources.py
index be38132d1d..e3b95e0faa 100644
--- a/src/3rdparty/freetype/src/tools/docmaker/sources.py
+++ b/src/3rdparty/freetype/src/tools/docmaker/sources.py
@@ -3,7 +3,7 @@
#
# Convert source code comments to multi-line blocks (library file).
#
-# Copyright 2002-2015 by
+# Copyright 2002-2018 by
# David Turner.
#
# This file is part of the FreeType project, and may only be used,
@@ -29,7 +29,7 @@
#
-import fileinput, re, sys, os, string
+import fileinput, re, string
################################################################
@@ -138,12 +138,24 @@ re_markup_tags = [re_markup_tag1, re_markup_tag2]
#
# A regular expression to detect a cross reference, after markup tags have
-# been stripped off. Group 1 is the reference, group 2 the rest of the
-# line.
+# been stripped off.
#
-# A cross reference consists of letters, digits, or characters `-' and `_'.
+# Two syntax forms are supported:
#
-re_crossref = re.compile( r'@((?:\w|-)*)(.*)' ) # @foo
+# @<name>
+# @<name>[<id>]
+#
+# where both `<name>' and `<id>' consist of alphanumeric characters, `_',
+# and `-'. Use `<id>' if there are multiple, valid `<name>' entries.
+#
+# Example: @foo[bar]
+#
+re_crossref = re.compile( r"""
+ @
+ (?P<name>(?:\w|-)+
+ (?:\[(?:\w|-)+\])?)
+ (?P<rest>.*)
+ """, re.VERBOSE )
#
# Two regular expressions to detect italic and bold markup, respectively.
@@ -159,7 +171,7 @@ re_bold = re.compile( r"\*((?:\w|-)(?:\w|'|-)*)\*(.*)" ) # *bold*
#
# This regular expression code to identify an URL has been taken from
#
-# http://mail.python.org/pipermail/tutor/2002-September/017228.html
+# https://mail.python.org/pipermail/tutor/2002-September/017228.html
#
# (with slight modifications).
#
@@ -284,10 +296,10 @@ class SourceBlock:
# debugging only -- not used in normal operations
def dump( self ):
if self.content:
- print "{{{content start---"
+ print( "{{{content start---" )
for l in self.content:
- print l
- print "---content end}}}"
+ print( l )
+ print( "---content end}}}" )
return
fmt = ""
@@ -295,7 +307,7 @@ class SourceBlock:
fmt = repr( self.format.id ) + " "
for line in self.lines:
- print line
+ print( line )
################################################################
diff --git a/src/3rdparty/freetype/src/tools/docmaker/tohtml.py b/src/3rdparty/freetype/src/tools/docmaker/tohtml.py
index bc6bcf0511..9f318a2a49 100644
--- a/src/3rdparty/freetype/src/tools/docmaker/tohtml.py
+++ b/src/3rdparty/freetype/src/tools/docmaker/tohtml.py
@@ -3,7 +3,7 @@
#
# A sub-class container of the `Formatter' class to produce HTML.
#
-# Copyright 2002-2015 by
+# Copyright 2002-2018 by
# David Turner.
#
# This file is part of the FreeType project, and may only be used,
@@ -25,7 +25,7 @@ import time
# The following strings define the HTML header used by all generated pages.
html_header_1 = """\
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-"http://www.w3.org/TR/html4/loose.dtd">
+"https://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
@@ -164,7 +164,8 @@ html_footer = """\
"""
# The header and footer used for each section.
-section_title_header = "<h1>"
+section_title_header1 = '<h1 id="'
+section_title_header2 = '">'
section_title_footer = "</h1>"
# The header and footer used for code segments.
@@ -309,7 +310,14 @@ class HtmlFormatter( Formatter ):
def make_block_url( self, block, name = None ):
if name == None:
name = block.name
- return self.make_section_url( block.section ) + "#" + name
+
+ try:
+ section_url = self.make_section_url( block.section )
+ except:
+ # we already have a section
+ section_url = self.make_section_url( block )
+
+ return section_url + "#" + name
def make_html_word( self, word ):
"""Analyze a simple word to detect cross-references and markup."""
@@ -317,11 +325,27 @@ class HtmlFormatter( Formatter ):
m = re_crossref.match( word )
if m:
try:
- name = m.group( 1 )
- rest = m.group( 2 )
+ name = m.group( 'name' )
+ rest = m.group( 'rest' )
block = self.identifiers[name]
url = self.make_block_url( block )
- return '<a href="' + url + '">' + name + '</a>' + rest
+ # display `foo[bar]' as `foo'
+ name = re.sub( r'\[.*\]', '', name )
+ # normalize url, following RFC 3986
+ url = string.replace( url, "[", "(" )
+ url = string.replace( url, "]", ")" )
+
+ try:
+ # for sections, display title
+ url = ( '&lsquo;<a href="' + url + '">'
+ + block.title + '</a>&rsquo;'
+ + rest )
+ except:
+ url = ( '<a href="' + url + '">'
+ + name + '</a>'
+ + rest )
+
+ return url
except:
# we detected a cross-reference to an unknown item
sys.stderr.write( "WARNING: undefined cross reference"
@@ -366,7 +390,7 @@ class HtmlFormatter( Formatter ):
"""Convert a code sequence to HTML."""
line = code_header + '\n'
for l in lines:
- line = line + html_quote( l ) + '\n'
+ line = line + html_quote( l ).rstrip() + '\n'
return line + code_footer
@@ -382,7 +406,7 @@ class HtmlFormatter( Formatter ):
return string.join( lines, '\n' )
def print_html_items( self, items ):
- print self.make_html_items( items )
+ print( self.make_html_items( items ) )
def print_html_field( self, field ):
if field.name:
@@ -390,10 +414,10 @@ class HtmlFormatter( Formatter ):
+ field.name
+ "</b></td><td>" )
- print self.make_html_items( field.items )
+ print( self.make_html_items( field.items ) )
if field.name:
- print "</td></tr></table>"
+ print( "</td></tr></table>" )
def html_source_quote( self, line, block_name = None ):
result = ""
@@ -417,16 +441,22 @@ class HtmlFormatter( Formatter ):
id = block.name
# link to a field ID if possible
- for markup in block.markups:
- if markup.tag == 'values':
- for field in markup.fields:
- if field.name:
- id = name
+ try:
+ for markup in block.markups:
+ if markup.tag == 'values':
+ for field in markup.fields:
+ if field.name:
+ id = name
+
+ result = ( result + prefix
+ + '<a href="'
+ + self.make_block_url( block, id )
+ + '">' + name + '</a>' )
+ except:
+ # sections don't have `markups'; however, we don't
+ # want references to sections here anyway
+ result = result + html_quote( line[:length] )
- result = ( result + prefix
- + '<a href="'
- + self.make_block_url( block, id )
- + '">' + name + '</a>' )
else:
result = result + html_quote( line[:length] )
@@ -438,14 +468,14 @@ class HtmlFormatter( Formatter ):
return result
def print_html_field_list( self, fields ):
- print '<table class="fields">'
+ print( '<table class="fields">' )
for field in fields:
- print ( '<tr><td class="val" id="' + field.name + '">'
- + field.name
- + '</td><td class="desc">' )
+ print( '<tr><td class="val" id="' + field.name + '">'
+ + field.name
+ + '</td><td class="desc">' )
self.print_html_items( field.items )
- print "</td></tr>"
- print "</table>"
+ print( "</td></tr>" )
+ print( "</table>" )
def print_html_markup( self, markup ):
table_fields = []
@@ -469,7 +499,7 @@ class HtmlFormatter( Formatter ):
# formatting the index
#
def index_enter( self ):
- print self.html_index_header
+ print( self.html_index_header )
self.index_items = {}
def index_name_enter( self, name ):
@@ -482,7 +512,7 @@ class HtmlFormatter( Formatter ):
count = len( self.block_index )
rows = ( count + self.columns - 1 ) // self.columns
- print '<table class="index">'
+ print( '<table class="index">' )
for r in range( rows ):
line = "<tr>"
for c in range( self.columns ):
@@ -490,20 +520,26 @@ class HtmlFormatter( Formatter ):
if i < count:
bname = self.block_index[r + c * rows]
url = self.index_items[bname]
+ # display `foo[bar]' as `foo (bar)'
+ bname = string.replace( bname, "[", " (" )
+ bname = string.replace( bname, "]", ")" )
+ # normalize url, following RFC 3986
+ url = string.replace( url, "[", "(" )
+ url = string.replace( url, "]", ")" )
line = ( line + '<td><a href="' + url + '">'
+ bname + '</a></td>' )
else:
line = line + '<td></td>'
line = line + "</tr>"
- print line
+ print( line )
- print "</table>"
+ print( "</table>" )
print( index_footer_start
+ self.file_prefix + "toc.html"
+ index_footer_end )
- print self.html_footer
+ print( self.html_footer )
self.index_items = {}
@@ -517,25 +553,25 @@ class HtmlFormatter( Formatter ):
# formatting the table of contents
#
def toc_enter( self ):
- print self.html_toc_header
- print "<h1>Table of Contents</h1>"
+ print( self.html_toc_header )
+ print( "<h1>Table of Contents</h1>" )
def toc_chapter_enter( self, chapter ):
- print chapter_header + string.join( chapter.title ) + chapter_inter
- print '<table class="toc">'
+ print( chapter_header + string.join( chapter.title ) + chapter_inter )
+ print( '<table class="toc">' )
def toc_section_enter( self, section ):
- print ( '<tr><td class="link">'
- + '<a href="' + self.make_section_url( section ) + '">'
- + section.title + '</a></td><td class="desc">' )
- print self.make_html_para( section.abstract )
+ print( '<tr><td class="link">'
+ + '<a href="' + self.make_section_url( section ) + '">'
+ + section.title + '</a></td><td class="desc">' )
+ print( self.make_html_para( section.abstract ) )
def toc_section_exit( self, section ):
- print "</td></tr>"
+ print( "</td></tr>" )
def toc_chapter_exit( self, chapter ):
- print "</table>"
- print chapter_footer
+ print( "</table>" )
+ print( chapter_footer )
def toc_index( self, index_filename ):
print( chapter_header
@@ -547,7 +583,7 @@ class HtmlFormatter( Formatter ):
+ self.file_prefix + "index.html"
+ toc_footer_end )
- print self.html_footer
+ print( self.html_footer )
def toc_dump( self, toc_filename = None, index_filename = None ):
if toc_filename == None:
@@ -562,9 +598,11 @@ class HtmlFormatter( Formatter ):
# formatting sections
#
def section_enter( self, section ):
- print self.html_header
+ print( self.html_header )
- print section_title_header + section.title + section_title_footer
+ print( section_title_header1 + section.name + section_title_header2
+ + section.title
+ + section_title_footer )
maxwidth = 0
for b in section.blocks.values():
@@ -574,8 +612,8 @@ class HtmlFormatter( Formatter ):
width = 70 # XXX magic number
if maxwidth > 0:
# print section synopsis
- print section_synopsis_header
- print '<table class="synopsis">'
+ print( section_synopsis_header )
+ print( '<table class="synopsis">' )
columns = width // maxwidth
if columns < 1:
@@ -601,26 +639,38 @@ class HtmlFormatter( Formatter ):
# even omit it completely)
line = line + "&nbsp;"
else:
- line = ( line + '<a href="#' + name + '">'
+ url = name
+ # display `foo[bar]' as `foo'
+ name = re.sub( r'\[.*\]', '', name )
+ # normalize url, following RFC 3986
+ url = string.replace( url, "[", "(" )
+ url = string.replace( url, "]", ")" )
+ line = ( line + '<a href="#' + url + '">'
+ name + '</a>' )
line = line + '</td>'
line = line + "</tr>"
- print line
+ print( line )
- print "</table>"
- print section_synopsis_footer
+ print( "</table>" )
+ print( section_synopsis_footer )
- print description_header
- print self.make_html_items( section.description )
- print description_footer
+ print( description_header )
+ print( self.make_html_items( section.description ) )
+ print( description_footer )
def block_enter( self, block ):
- print block_header
+ print( block_header )
# place html anchor if needed
if block.name:
- print( '<h3 id="' + block.name + '">' + block.name + '</h3>' )
+ url = block.name
+ # display `foo[bar]' as `foo'
+ name = re.sub( r'\[.*\]', '', block.name )
+ # normalize url, following RFC 3986
+ url = string.replace( url, "[", "(" )
+ url = string.replace( url, "]", ")" )
+ print( '<h3 id="' + url + '">' + name + '</h3>' )
# dump the block C source lines now
if block.code:
@@ -636,28 +686,28 @@ class HtmlFormatter( Formatter ):
# + " '" + block.source.filename + "'.\n" )
if header:
- print ( header_location_header
- + 'Defined in ' + header + '.'
- + header_location_footer )
+ print( header_location_header
+ + 'Defined in ' + header + '.'
+ + header_location_footer )
- print source_header
+ print( source_header )
for l in block.code:
- print self.html_source_quote( l, block.name )
- print source_footer
+ print( self.html_source_quote( l, block.name ) )
+ print( source_footer )
def markup_enter( self, markup, block ):
if markup.tag == "description":
- print description_header
+ print( description_header )
else:
- print marker_header + markup.tag + marker_inter
+ print( marker_header + markup.tag + marker_inter )
self.print_html_markup( markup )
def markup_exit( self, markup, block ):
if markup.tag == "description":
- print description_footer
+ print( description_footer )
else:
- print marker_footer
+ print( marker_footer )
def block_exit( self, block ):
print( block_footer_start + self.file_prefix + "index.html"
@@ -665,7 +715,7 @@ class HtmlFormatter( Formatter ):
+ block_footer_end )
def section_exit( self, section ):
- print html_footer
+ print( html_footer )
def section_dump_all( self ):
for section in self.sections:
diff --git a/src/3rdparty/freetype/src/tools/docmaker/utils.py b/src/3rdparty/freetype/src/tools/docmaker/utils.py
index 254083e92e..f40f1674a0 100644
--- a/src/3rdparty/freetype/src/tools/docmaker/utils.py
+++ b/src/3rdparty/freetype/src/tools/docmaker/utils.py
@@ -3,7 +3,7 @@
#
# Auxiliary functions for the `docmaker' tool (library file).
#
-# Copyright 2002-2015 by
+# Copyright 2002-2018 by
# David Turner.
#
# This file is part of the FreeType project, and may only be used,