From 1eb99bf05849e3108129d32eaacaa40c9e266c4b Mon Sep 17 00:00:00 2001 From: Luigi Scarso Date: Sat, 15 Feb 2020 12:45:08 +0000 Subject: sync with luatex rev. 7287 git-svn-id: svn://tug.org/texlive/trunk@53789 c570f23f-e606-0410-a88d-b1316a301751 --- .../texk/web2c/luatexdir/luaharfbuzz/README-win.md | 53 ----- .../texk/web2c/luatexdir/luaharfbuzz/README.md | 19 +- .../texk/web2c/luatexdir/luaharfbuzz/config.ld | 2 +- .../luaharfbuzz/docs/examples/core_types.lua.html | 2 +- .../docs/examples/custom_callbacks.lua.html | 85 -------- .../docs/examples/harfbuzz_setup.lua.html | 231 --------------------- .../docs/examples/ot_font_loader.lua.html | 139 ------------- .../docs/examples/package_path_searcher.lua.html | 104 ---------- .../web2c/luatexdir/luaharfbuzz/docs/index.html | 12 +- .../fonts/TwitterColorEmoji-SVGinOT.ttf | Bin 0 -> 4232 bytes .../luaharfbuzz/luaharfbuzz-1.0.0-1.rockspec | 51 ----- .../luaharfbuzz/luaharfbuzz-1.1.0-1.rockspec | 46 ++++ .../luaharfbuzz/luaharfbuzz-scm-1.rockspec | 5 +- .../luatexdir/luaharfbuzz/spec/buffer_spec.lua | 55 +++++ .../luatexdir/luaharfbuzz/spec/harfbuzz_spec.lua | 42 +++- .../luatexdir/luaharfbuzz/src/harfbuzz.luadoc | 10 +- .../luatexdir/luaharfbuzz/src/luaharfbuzz/buffer.c | 116 ++++++++--- .../luatexdir/luaharfbuzz/src/luaharfbuzz/face.c | 27 +++ .../luaharfbuzz/src/luaharfbuzz/feature.c | 69 ++++++ .../luatexdir/luaharfbuzz/src/luaharfbuzz/font.c | 2 +- .../luaharfbuzz/src/luaharfbuzz/luaharfbuzz.c | 28 ++- .../luatexdir/luaharfbuzz/status/full_api.txt | 142 ++++++++++++- 22 files changed, 517 insertions(+), 723 deletions(-) delete mode 100644 Build/source/texk/web2c/luatexdir/luaharfbuzz/README-win.md delete mode 100644 Build/source/texk/web2c/luatexdir/luaharfbuzz/docs/examples/custom_callbacks.lua.html delete mode 100644 Build/source/texk/web2c/luatexdir/luaharfbuzz/docs/examples/harfbuzz_setup.lua.html delete mode 100644 Build/source/texk/web2c/luatexdir/luaharfbuzz/docs/examples/ot_font_loader.lua.html delete mode 100644 Build/source/texk/web2c/luatexdir/luaharfbuzz/docs/examples/package_path_searcher.lua.html create mode 100644 Build/source/texk/web2c/luatexdir/luaharfbuzz/fonts/TwitterColorEmoji-SVGinOT.ttf delete mode 100644 Build/source/texk/web2c/luatexdir/luaharfbuzz/luaharfbuzz-1.0.0-1.rockspec create mode 100644 Build/source/texk/web2c/luatexdir/luaharfbuzz/luaharfbuzz-1.1.0-1.rockspec (limited to 'Build/source/texk/web2c/luatexdir/luaharfbuzz') diff --git a/Build/source/texk/web2c/luatexdir/luaharfbuzz/README-win.md b/Build/source/texk/web2c/luatexdir/luaharfbuzz/README-win.md deleted file mode 100644 index d7a769ffa4b..00000000000 --- a/Build/source/texk/web2c/luatexdir/luaharfbuzz/README-win.md +++ /dev/null @@ -1,53 +0,0 @@ -# Building Harfbuzz and _luaharfbuzz_ on Windows - -## Building Harfbuzz - -### Prerequisites -* [Visual Studio Community Edition](https://www.visualstudio.com/vs/community/) -* C++ Support for Visual Studio (See [here](http://stackoverflow.com/questions/31953769/visual-studio-doesnt-have-cl-exe)) - -### Building -* Download the Harfbuzz source for win32 from the [releases pages](https://github.com/behdad/harfbuzz/releases) (look for a zip file that ends with _-win32_, for e.g. _harfbuzz-1.4.2-win32.zip_), and unzip it. -* Launch the Visual Studio developer prompt for the platform you want to target. This is very important. For e.g, on my 64-bit system, I am using _VS2015 x64 Native Tools Command Prompt_ -* Navigate to the _win32_ folder in the Harfbuzz source tree and do `nmake /f Makefile.vc CFG=release` -* This should generate _harfbuzz.lib_ and _harfbuzz-vs14.dll_. - -## Copying Harfbuzz headers and DLL to the right locations -The Harfbuzz headers and DLLs must be copied to the right locations, for Lua and LuaRocks to be able to find them during installation and running: - -* Copy all the Harfbuzz header (_src/*.h_) files to _C:\external\include\harfbuzz_. This is where LuaRocks will look for them by default. Make sure the header files are in the _harfbuzz_ sub-directory under _C:\external\include_, otherwise it will not work. -* Copy _harfbuzz.lib_ and _harfbuzz-vs14.dll_ to the folder _C:\external\lib_. This is where LuaRocks will look for them by default. -* Copy _harfbuzz-vs14.dll_ to _C:\Windows\System32_. This is where running programs can locate the Harfbuzz DLL. - -## Installing Lua and LuaRocks -It is highly recommended that you install Lua 5.2 and LuaRocks in a sandboxed environment on your machine. [Hererocks] makes it dead simple to do on Windows. Make sure you have installed Python first. On my system, I just did `chocolatey install python`, but you can use an alternate method and skip running that command below. - -[Hererocks]:https://github.com/mpeterv/hererocks - -``` -chocolatey install python -wget https://raw.githubusercontent.com/mpeterv/hererocks/latest/hererocks.py -python hererocks.py lua52 -l5.2 -rlatest -source lua52/bin/activate -``` -## Install _luaharfbuzz_ -If you followed the steps in the previous sections, and have a sandboxed Lua installation, which the Lua program on %PATH%, then doing the following should just work: - -``` -C:\> luarocks install luaharfbuzz -``` - -This will download the _luaharfbuzz_ source, compile the C modules, link them against Lua and Harfbuzz, and install it in the right location. - -## Test -Test whether the installation was successful by loading _luaharfbuzz_ in the Lua REPL - -``` -C:\> lua -Lua 5.2.4 Copyright (C) 1994-2015 Lua.org, PUC-Rio -> hb = require("harfbuzz") -> print(hb.version()) -1.4.1 -> -``` - diff --git a/Build/source/texk/web2c/luatexdir/luaharfbuzz/README.md b/Build/source/texk/web2c/luatexdir/luaharfbuzz/README.md index f5a900c65b1..c5cee58f869 100644 --- a/Build/source/texk/web2c/luatexdir/luaharfbuzz/README.md +++ b/Build/source/texk/web2c/luatexdir/luaharfbuzz/README.md @@ -19,10 +19,17 @@ HarfBuzz is an OpenType text shaping engine. It is used in software like Qt, Pango, Firefox, Chromium, XeTeX and LibreOffice. _luaharfbuzz_ provides bindings for the most common types in Harfbuzz. The -initial motivation for building it is to use Harfbuzz with the [LuaTeX] +initial motivation for building it was to use Harfbuzz with the [LuaTeX] typesetting system. However, the module isn’t tied to LuaTeX in any way. It can be used with any Lua codebase. +luaharfbuzz is currently being used inside [HarfTeX], a TeX engine built +on top of LuaTeX and designed to use Harfbuzz for shaping text. For more +details read this TUGboat journal article titled [Bringing world scripts to LuaTeX: The +HarfBuzz experiment][tugboat-article] + +[HarfTeX]: https://github.com/khaledhosny/harftex +[tugboat-article]: https://tug.org/TUGboat/tb40-1/tb124hosny-harfbuzz.pdf [LuaTeX]:luatex.org ## Installing Harfbuzz @@ -43,9 +50,6 @@ brew install harfbuzz apt-get install libharfbuzz0b libharfbuzz-dev ``` -#### Windows -Getting the whole setup running on Windows is very tedious, so all instructions are in their own file [README-win.md](https://github.com/deepakjois/luaharfbuzz/blob/master/README-win.md). - #### Other Platforms _Send a pull request if you want to include specific instructions to install Harfbuzz on your preferred platform._ @@ -139,6 +143,8 @@ In order to make changes to the code and run the tests, the following dependenci * [Busted](http://olivinelabs.com/busted/) – `luarocks install busted` * [luacheck](luacheck.readthedocs.org) – `luarocks install luacheck` +* [luacov](https://keplerproject.github.io/luacov/) – `luarocks install luacov` +* [ldoc](https://stevedonovan.github.io/ldoc/) – `luarocks install ldoc` Run the test suite: ``` @@ -150,5 +156,10 @@ Lint the codebase: make lint ``` +Generate documentation from sources: +``` +make doc +``` + ## Contact Open a Github issue, or email me at . diff --git a/Build/source/texk/web2c/luatexdir/luaharfbuzz/config.ld b/Build/source/texk/web2c/luatexdir/luaharfbuzz/config.ld index 95d27f9a39f..d37be652ca9 100644 --- a/Build/source/texk/web2c/luatexdir/luaharfbuzz/config.ld +++ b/Build/source/texk/web2c/luatexdir/luaharfbuzz/config.ld @@ -1,6 +1,6 @@ project = 'luaharfbuzz' description = 'Lua bindings to Harfbuzz' -full_description = 'The documentation is available on the @{https://github.com/deepakjois/luaharfbuzz/wiki|wiki}' +full_description = 'The documentation is available on the @{https://github.com/ufytex/luaharfbuzz/wiki|wiki}' use_markdown_titles = true backtick_references = false title = 'luaharfbuzz Documentation' diff --git a/Build/source/texk/web2c/luatexdir/luaharfbuzz/docs/examples/core_types.lua.html b/Build/source/texk/web2c/luatexdir/luaharfbuzz/docs/examples/core_types.lua.html index fe9e5c39c9b..6345ea3c6fa 100644 --- a/Build/source/texk/web2c/luatexdir/luaharfbuzz/docs/examples/core_types.lua.html +++ b/Build/source/texk/web2c/luatexdir/luaharfbuzz/docs/examples/core_types.lua.html @@ -101,7 +101,7 @@ glyphs = buf:get_glyphs()
generated by LDoc 1.4.6 -Last updated 2019-04-13 17:03:03 +Last updated 2019-07-31 18:39:39
diff --git a/Build/source/texk/web2c/luatexdir/luaharfbuzz/docs/examples/custom_callbacks.lua.html b/Build/source/texk/web2c/luatexdir/luaharfbuzz/docs/examples/custom_callbacks.lua.html deleted file mode 100644 index eff09e27b8d..00000000000 --- a/Build/source/texk/web2c/luatexdir/luaharfbuzz/docs/examples/custom_callbacks.lua.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - luaharfbuzz Documentation - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

custom_callbacks.lua

-
--- Switch off some callbacks
-callback.register("hyphenate", false)
-callback.register("ligaturing", false)
-callback.register("kerning", false)
-
--- Add debug statements to some callbacks
-callback.register("post_linebreak_filter", function()
-  texio.write_nl("POST_LINEBREAK")
-  return true
-end)
-
-callback.register("hpack_filter", function()
-  texio.write_nl("HPACK")
-  return true
-end)
-
-callback.register("vpack_filter", function()
-  texio.write_nl("VPACK")
-  return true
-end)
-
-callback.register("buildpage_filter", function(extrainfo)
-  texio.write_nl("BUILDPAGE_FILTER "..extrainfo)
-end)
- - -
-
-
-generated by LDoc 1.4.5 -Last updated 2016-08-31 21:59:58 -
-
- - diff --git a/Build/source/texk/web2c/luatexdir/luaharfbuzz/docs/examples/harfbuzz_setup.lua.html b/Build/source/texk/web2c/luatexdir/luaharfbuzz/docs/examples/harfbuzz_setup.lua.html deleted file mode 100644 index dba607a9f6c..00000000000 --- a/Build/source/texk/web2c/luatexdir/luaharfbuzz/docs/examples/harfbuzz_setup.lua.html +++ /dev/null @@ -1,231 +0,0 @@ - - - - - luaharfbuzz Documentation - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

harfbuzz_setup.lua

-
--- Allow external Lua modules to be loaded.
-dofile 'package_path_searcher.lua'
-
--- Attach a OpenType font loader to define_font callback.
-require 'ot_font_loader'
-
--- Disable some callbacks, and attach debug logging to others.
-require 'custom_callbacks'
-
--- List all callbacks
-local serpent = require 'serpent'
-texio.write_nl(serpent.block(callback.list()))
-
--- Load luaharfbuzz
-local harfbuzz = require 'harfbuzz'
-
-local lt_to_hb_dir = { TLT = "ltr", TRT = "rtl" }
--- local hb_to_lt_dir = { ltr = "TLT", rtl = "TRT" }
-
-local function upem_to_sp(v,font)
-  return math.floor(v / font.units_per_em * font.size)
-end
-
--- Print the contents of a nodelist.
--- Glyph nodes are printed as UTF-8 characters, while other nodes are printed
--- by calling node.type on it, along with the subtype of the node.
-local function show_nodes (head, raw)
-  local nodes = ''
-  for item in node.traverse(head) do
-    local i = item.id
-    if i == node.id("glyph") then
-      if raw then i = string.format('<glyph %d>', item.char) else i = unicode.utf8.char(item.char) end
-    else
-      i = string.format('<%s%s>', node.type(i), ( item.subtype and ("(".. item.subtype .. ")") or ''))
-    end
-    nodes = nodes .. i .. ' '
-  end
-  texio.write_nl(nodes)
-  return true
-end
-
--- Process a paragraph nodelist and shape it with Harfbuzz.
--- Only works for the most simple paragraphs. Check the assertions in the code
--- to understand what kind of nodes the shaping routine is expecting at
--- any point.
-local function process_nodes(head)
-  -- Pointer to traverse head nodelist
-  local head_slider = head
-
-  -- First node is a local_par
-  assert(head_slider.id == node.id("local_par"), "local_par expected")
-
-  -- Get direction
-  local dir = head_slider.dir
-  texio.write_nl("direction is: "..dir)
-
-
-  -- Second node is indentation
-  head_slider = head_slider.next
-  assert(head_slider.id == node.id("hlist") and head_slider.subtype == 3, "parindent hlist expected")
-
-  -- Check if font can be shaped by Harfbuzz
-  local fontid = head_slider.next.font
-  texio.write_nl("fontid is "..fontid)
-  local font = font.getfont(fontid)
-  if not font.harfbuzz then return head end
-  texio.write_nl("paragraph can be shaped by Harfbuzz")
-
-  -- Initialise new head
-  local new_head = node.copy_list(head, head_slider.next)
-  assert(node.length(new_head) == 2, "expected two nodes in new_head")
-
-  -- Pointer to traverse new heade nodelist
-  local new_head_slider = node.slide(new_head)
-
-  -- Build text
-  local codepoints = { }
-  while head_slider.next.id ~= node.id("penalty") do
-    head_slider = head_slider.next
-    if head_slider.id == node.id("glyph") then
-      table.insert(codepoints, head_slider.char)
-    elseif head_slider.id == node.id("glue") and head_slider.subtype == 13 then
-      table.insert(codepoints, 0x20)
-    else
-      error(string.format("Cant handle node of type %s, subtype %s", node.type(head_slider.id), tostring(head_slider.subtype)))
-    end
-  end
-
-  -- Initialise new tail at the last penalty node.
-  local new_tail = head_slider.next
-
-  -- Skip over penalty node
-  head_slider = head_slider.next.next
-
-  -- Last node is a \parfillskip
-  assert(head_slider.id == node.id("glue") and head_slider.subtype == 15, "\\parfillskip expected")
-  assert(not head_slider.next, "Expected this to be the last node.")
-
-  -- Shape text
-  local buf = harfbuzz.Buffer.new()
-  buf:set_cluster_level(harfbuzz.Buffer.HB_BUFFER_CLUSTER_LEVEL_CHARACTERS)
-  buf:add_codepoints(codepoints)
-  harfbuzz.shape(font.harfbuzz.font,buf, { direction = lt_to_hb_dir[dir] })
-
-  -- Create new nodes from shaped text
-  if dir == 'TRT' then buf:reverse() end
-  local glyphs = buf:get_glyph_infos_and_positions()
-
-  for _, v in ipairs(glyphs) do
-    local n,k -- Node and (optional) Kerning
-    local char = font.backmap[v.codepoint]
-    if codepoints[v.cluster+1] == 0x20 then
-      assert(char == 0x20 or char == 0xa0, "Expected char to be 0x20 or 0xa0")
-      n = node.new("glue")
-      n.subtype = 0
-      n.width = font.parameters.space
-      n.stretch = font.parameters.space_stretch
-      n.shrink = font.parameters.space_shrink
-      new_head_slider.next = n
-    else
-      -- Create glyph node
-      n = node.new("glyph")
-      n.font = fontid
-      n.char = char
-      n.subtype = 1
-
-      -- Set offsets from Harfbuzz data
-      n.yoffset = upem_to_sp(v.y_offset, font)
-      n.xoffset = upem_to_sp(v.x_offset, font)
-      if dir == 'TRT' then n.xoffset = n.xoffset * -1 end
-
-      -- Adjust kerning if Harfbuzz’s x_advance does not match glyph width
-      local x_advance = upem_to_sp(v.x_advance, font)
-      if  math.abs(x_advance - n.width) > 1 then -- needs kerning
-        k = node.new("kern")
-        k.kern = (x_advance - n.width)
-      end
-
-      -- Insert glyph node into new list,
-      -- adjusting for direction and kerning.
-      if k then
-        if dir == 'TRT' then -- kerning goes before glyph
-          k.next = n
-          new_head_slider.next = k
-        else -- kerning goes after glyph
-          n.next = k
-          new_head_slider.next = n
-        end
-      else -- no kerning
-        new_head_slider.next = n
-      end
-    end
-    new_head_slider = node.slide(new_head_slider)
-  end
-
-  new_head_slider.next = new_tail
-  texio.write_nl("No. of nodes after shaping: "..node.length(new_head))
-  show_nodes(new_head, true)
-  return new_head
-end
-
--- Callback function
-local function show_and_process_nodes(head)
-  texio.write_nl("No. of nodes: "..node.length(head))
-  show_nodes(head)
-  return process_nodes(head)
-end
-
--- Register shaping callback
-callback.register("pre_linebreak_filter", show_and_process_nodes)
- - -
-
-
-generated by LDoc 1.4.5 -Last updated 2016-08-31 21:59:58 -
-
- - diff --git a/Build/source/texk/web2c/luatexdir/luaharfbuzz/docs/examples/ot_font_loader.lua.html b/Build/source/texk/web2c/luatexdir/luaharfbuzz/docs/examples/ot_font_loader.lua.html deleted file mode 100644 index 1abf52eebde..00000000000 --- a/Build/source/texk/web2c/luatexdir/luaharfbuzz/docs/examples/ot_font_loader.lua.html +++ /dev/null @@ -1,139 +0,0 @@ - - - - - luaharfbuzz Documentation - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

ot_font_loader.lua

-
-local harfbuzz = require('harfbuzz')
-
--- Load OpenType font.
--- https://tug.org/TUGboat/tb33-1/tb103isambert.pdf
-local function read_font (name, size, fontid)
-  if size < 0 then
-    size = size * tex.sp("10pt") / -1000
-  end
-
-  -- Load file using fontloader.open
-  local f = fontloader.open (name)
-  local fonttable = fontloader.to_table(f)
-  fontloader.close(f)
-
-  local metrics = {
-    name = fonttable.fontname,
-    fullname = fonttable.fontname..fontid,
-    psname = fonttable.fontname,
-    type = "real",
-    filename = name,
-    format = string.match(string.lower(name), "otf$") and "opentype" or string.match(string.lower(name), "ttf$") and "truetype",
-    embedding = 'subset',
-    size = size,
-    designsize = fonttable.design_size*6553.6,
-    cidinfo = fonttable.cidinfo,
-    units_per_em = fonttable.units_per_em
-  }
-
-  -- Scaling for font metrics
-  local mag = size / fonttable.units_per_em
-
-  -- Find glyph for 0x20, and get width for spacing glue.
-  local space_glyph = fonttable.map.map[0x20]
-  local space_glyph_table = fonttable.glyphs[space_glyph]
-  local space_glyph_width = space_glyph_table.width * mag
-
-  metrics.parameters = {
-    slant = 0,
-    space = space_glyph_width,
-    space_stretch = 1.5 * space_glyph_width,
-    space_shrink = 0.5 * space_glyph_width,
-    x_height = fonttable.pfminfo.os2_xheight * mag,
-    quad = 1.0 * size,
-    extra_space = 0
-  }
-
-  -- Save backmap in TeX font, so we can get char code from glyph index
-  -- obtainded from Harfbuzz
-  metrics.backmap = fonttable.map.backmap
-
-  metrics.characters = { }
-  for char, glyph in pairs(fonttable.map.map) do
-    local glyph_table = fonttable.glyphs[glyph]
-    metrics.characters[char] = {
-      index = glyph,
-      width = glyph_table.width * mag,
-      name = glyph_table.name,
-    }
-    if glyph_table.boundingbox[4] then
-      metrics.characters[char].height = glyph_table.boundingbox[4] * mag
-    end
-    if glyph_table.boundingbox[2] then
-      metrics.characters[char].depth = -glyph_table.boundingbox[2] * mag
-    end
-  end
-
-  -- Store Harfbuzz data in the font to retrieve it in the shaping routine.
-  local face = harfbuzz.Face.new(name)
-  metrics.harfbuzz = {
-    face = face,
-    font = harfbuzz.Font.new(face)
-  }
-
-  return metrics
-end
-
--- Register OpenType font loader in define_font callback.
-callback.register('define_font', read_font, "font loader")
- - -
-
-
-generated by LDoc 1.4.5 -Last updated 2016-08-31 21:59:58 -
-
- - diff --git a/Build/source/texk/web2c/luatexdir/luaharfbuzz/docs/examples/package_path_searcher.lua.html b/Build/source/texk/web2c/luatexdir/luaharfbuzz/docs/examples/package_path_searcher.lua.html deleted file mode 100644 index 9ff317b2ea0..00000000000 --- a/Build/source/texk/web2c/luatexdir/luaharfbuzz/docs/examples/package_path_searcher.lua.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - luaharfbuzz Documentation - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

package_path_searcher.lua

-
--- Allows Lua modules to be loaded from package.path and package.cpath.
---
--- This behavior is overridden by default in LuaTeX. This module reverts the
--- packaging searching logic to use package.path and package.cpath first,
--- failing which it tries to use the overridden loading logic (which uses
--- kpse).
---
--- Package Loading References:
--- 1. http://www.lua.org/manual/5.2/manual.html#pdf-package.searchers
--- 2. LuaTeX Manual, Section 3.2, Lua behavior
-
-local make_loader = function(path, pos,loadfunc)
-  local default_loader = package.searchers[pos]
-  local loader = function(name)
-    local file = package.searchpath(name,path)
-    if not file then
-      local msg = "\n\t[lualoader] Search failed"
-      local ret = default_loader(name)
-      if type(ret) == "string" then
-        return msg ..ret
-        elseif type(ret) == "nil" then
-          return msg
-        else
-          return ret
-        end
-      end
-      local loader,err = loadfunc(file)
-      if not loader then
-        return "\n\t[lualoader] Loading error:\n\t"..err
-      end
-      return loader
-  end
-    package.searchers[pos] = loader
-end
-
-local binary_loader = function(file)
-  local base = file:match("/([^%.]+)%.[%w]+$")
-  local symbol = base:gsub("%.","_")
-  return package.loadlib(file, "luaopen_"..symbol)
-end
-
-make_loader(package.path,2,loadfile)
-make_loader(package.cpath,3, binary_loader)
- - -
-
-
-generated by LDoc 1.4.5 -Last updated 2016-08-31 21:59:58 -
-
- - diff --git a/Build/source/texk/web2c/luatexdir/luaharfbuzz/docs/index.html b/Build/source/texk/web2c/luatexdir/luaharfbuzz/docs/index.html index 443a4117ffc..d1aaf74c0fa 100644 --- a/Build/source/texk/web2c/luatexdir/luaharfbuzz/docs/index.html +++ b/Build/source/texk/web2c/luatexdir/luaharfbuzz/docs/index.html @@ -66,9 +66,9 @@

Info:

@@ -651,7 +651,7 @@
  • language: A Language object representing the language.
  • features: features to enable, specified as either of the following.
  • @@ -1774,7 +1774,7 @@

    Parameters:

    @@ -2822,7 +2822,7 @@
    generated by LDoc 1.4.6 -Last updated 2019-05-01 16:42:35 +Last updated 2019-07-31 18:39:39
    diff --git a/Build/source/texk/web2c/luatexdir/luaharfbuzz/fonts/TwitterColorEmoji-SVGinOT.ttf b/Build/source/texk/web2c/luatexdir/luaharfbuzz/fonts/TwitterColorEmoji-SVGinOT.ttf new file mode 100644 index 00000000000..a60d3ff3198 Binary files /dev/null and b/Build/source/texk/web2c/luatexdir/luaharfbuzz/fonts/TwitterColorEmoji-SVGinOT.ttf differ diff --git a/Build/source/texk/web2c/luatexdir/luaharfbuzz/luaharfbuzz-1.0.0-1.rockspec b/Build/source/texk/web2c/luatexdir/luaharfbuzz/luaharfbuzz-1.0.0-1.rockspec deleted file mode 100644 index c7cd2cc8c93..00000000000 --- a/Build/source/texk/web2c/luatexdir/luaharfbuzz/luaharfbuzz-1.0.0-1.rockspec +++ /dev/null @@ -1,51 +0,0 @@ -package = "luaharfbuzz" -version = "1.0.0-1" -source = { - url = "git://github.com/deepakjois/luaharfbuzz", - tag = "v1.0.0" -} -description = { - summary = "Lua bindings for the Harfbuzz text shaping library", - homepage = "https://github.com/deepakjois/luaharfbuzz", - license = "MIT", - maintainer = "Deepak Jois " -} -dependencies = { - "lua >= 5.2" -} -external_dependencies = { - HARFBUZZ = { - header = "harfbuzz/hb.h" - } -} -build = { - type = "builtin", - modules = { - harfbuzz = "src/harfbuzz.lua", - luaharfbuzz = { - incdirs = { - "$(HARFBUZZ_INCDIR)/harfbuzz" - }, - libdirs = { - "$(HARFBUZZ_LIBDIR)" - }, - libraries = { - "harfbuzz" - }, - sources = { - "src/luaharfbuzz/luaharfbuzz.c", - "src/luaharfbuzz/blob.c", - "src/luaharfbuzz/face.c", - "src/luaharfbuzz/font.c", - "src/luaharfbuzz/buffer.c", - "src/luaharfbuzz/feature.c", - "src/luaharfbuzz/tag.c", - "src/luaharfbuzz/unicode.c", - "src/luaharfbuzz/script.c", - "src/luaharfbuzz/direction.c", - "src/luaharfbuzz/language.c", - "src/luaharfbuzz/class_utils.c" - } - } - } -} diff --git a/Build/source/texk/web2c/luatexdir/luaharfbuzz/luaharfbuzz-1.1.0-1.rockspec b/Build/source/texk/web2c/luatexdir/luaharfbuzz/luaharfbuzz-1.1.0-1.rockspec new file mode 100644 index 00000000000..17a84532b73 --- /dev/null +++ b/Build/source/texk/web2c/luatexdir/luaharfbuzz/luaharfbuzz-1.1.0-1.rockspec @@ -0,0 +1,46 @@ +package = "luaharfbuzz" +version = "1.1.0-1" +source = { + url = "git://github.com/ufytex/luaharfbuzz", + tag = "v1.1.0" +} +description = { + summary = "Lua bindings for the Harfbuzz text shaping library", + homepage = "https://github.com/ufytex/luaharfbuzz", + license = "MIT", + maintainer = "Deepak Jois " +} +dependencies = { + "lua >= 5.2" +} +build = { + type = "builtin", + modules = { + harfbuzz ="src/harfbuzz.lua", + luaharfbuzz= { + sources = { + "src/luaharfbuzz/luaharfbuzz.c", + "src/luaharfbuzz/blob.c", + "src/luaharfbuzz/face.c", + "src/luaharfbuzz/font.c", + "src/luaharfbuzz/buffer.c", + "src/luaharfbuzz/feature.c", + "src/luaharfbuzz/tag.c", + "src/luaharfbuzz/ot.c", + "src/luaharfbuzz/unicode.c", + "src/luaharfbuzz/script.c", + "src/luaharfbuzz/direction.c", + "src/luaharfbuzz/language.c", + "src/luaharfbuzz/class_utils.c" + }, + libraries = {"harfbuzz"}, + incdirs = {"$(HARFBUZZ_INCDIR)/harfbuzz"}, + libdirs = {"$(HARFBUZZ_LIBDIR)"} + } + } +} +external_dependencies = { + HARFBUZZ = { + header = "harfbuzz/hb.h" + } +} diff --git a/Build/source/texk/web2c/luatexdir/luaharfbuzz/luaharfbuzz-scm-1.rockspec b/Build/source/texk/web2c/luatexdir/luaharfbuzz/luaharfbuzz-scm-1.rockspec index 108dde354fc..31ae2ab4fb7 100644 --- a/Build/source/texk/web2c/luatexdir/luaharfbuzz/luaharfbuzz-scm-1.rockspec +++ b/Build/source/texk/web2c/luatexdir/luaharfbuzz/luaharfbuzz-scm-1.rockspec @@ -1,3 +1,4 @@ +rockspec_format = "3.0" package = "luaharfbuzz" version = "scm-1" source = { @@ -7,7 +8,9 @@ description = { summary = "Lua bindings for the Harfbuzz text shaping library", homepage = "https://github.com/ufytex/luaharfbuzz", license = "MIT", - maintainer = "Deepak Jois " + maintainer = "Deepak Jois ", + issues_url = "https://github.com/ufytex/luaharfbuzz/issues", + labels = {"unicode", "fonts"} } dependencies = { "lua >= 5.2" diff --git a/Build/source/texk/web2c/luatexdir/luaharfbuzz/spec/buffer_spec.lua b/Build/source/texk/web2c/luatexdir/luaharfbuzz/spec/buffer_spec.lua index 1950354eaf6..d0a7757e3bf 100644 --- a/Build/source/texk/web2c/luatexdir/luaharfbuzz/spec/buffer_spec.lua +++ b/Build/source/texk/web2c/luatexdir/luaharfbuzz/spec/buffer_spec.lua @@ -167,6 +167,61 @@ describe("harfbuzz.Buffer", function() b:set_cluster_level(harfbuzz.Buffer.CLUSTER_LEVEL_CHARACTERS) assert.are_equal(harfbuzz.Buffer.CLUSTER_LEVEL_CHARACTERS, b:get_cluster_level()) end) + + it("can get the replacement glyph for invisible characters of the buffer", function() + local b = harfbuzz.Buffer.new() + assert.are_equal(0, b:get_invisible_glyph()) + end) + + it("can set the replacement glyph for invisible characters of the buffer", function() + local b = harfbuzz.Buffer.new() + b:set_invisible_glyph(3) + assert.are_equal(3, b:get_invisible_glyph()) + end) + + it("can get the replacement codepoint of the buffer", function() + local b = harfbuzz.Buffer.new() + assert.are_equal(0xFFFD, b:get_replacement_codepoint()) + end) + + it("can set the replacement codepoint of the buffer", function() + local b = harfbuzz.Buffer.new() + b:set_replacement_codepoint(0xFFFF) + assert.are_equal(0xFFFF, b:get_replacement_codepoint()) + b:add_utf8("\xFF") + local glyphs = b:get_glyphs() + assert.are_equal(1, #glyphs) + assert.are_equal(0xFFFF, glyphs[1].codepoint) + end) + + it("can get the flags of the buffer", function() + local b = harfbuzz.Buffer.new() + assert.are_equal(harfbuzz.Buffer.FLAG_DEFAULT, b:get_flags()) + end) + + it("can set the flags of the buffer", function() + local b = harfbuzz.Buffer.new() + b:set_flags(harfbuzz.Buffer.FLAG_DEFAULT | harfbuzz.Buffer.FLAG_BOT) + assert.are_equal(harfbuzz.Buffer.FLAG_DEFAULT | harfbuzz.Buffer.FLAG_BOT, b:get_flags()) + end) + + it("can clear the buffer", function() + local b = harfbuzz.Buffer.new() + b:add_utf8("abc") + b:set_flags(harfbuzz.Buffer.FLAG_DEFAULT | harfbuzz.Buffer.FLAG_BOT) + b:clear_contents() + assert.are_equal(0, b:get_length()) + assert.are_equal(harfbuzz.Buffer.FLAG_DEFAULT | harfbuzz.Buffer.FLAG_BOT, b:get_flags()) + end) + + it("can reset the buffer", function() + local b = harfbuzz.Buffer.new() + b:add_utf8("abc") + b:set_flags(harfbuzz.Buffer.FLAG_DEFAULT | harfbuzz.Buffer.FLAG_BOT) + b:reset() + assert.are_equal(0, b:get_length()) + assert.are_equal(harfbuzz.Buffer.FLAG_DEFAULT, b:get_flags()) + end) end) diff --git a/Build/source/texk/web2c/luatexdir/luaharfbuzz/spec/harfbuzz_spec.lua b/Build/source/texk/web2c/luatexdir/luaharfbuzz/spec/harfbuzz_spec.lua index 966a1865faf..dfae07d8e65 100644 --- a/Build/source/texk/web2c/luatexdir/luaharfbuzz/spec/harfbuzz_spec.lua +++ b/Build/source/texk/web2c/luatexdir/luaharfbuzz/spec/harfbuzz_spec.lua @@ -140,12 +140,28 @@ describe("harfbuzz module", function() assert.are_same(layers,f:ot_color_glyph_get_layers(100)) end) - it("can check color layers", function() + it("can check PNG glyph support", function() local f = harfbuzz.Face.new('fonts/notocoloremoji-subset.ttf') assert.are_equal(false,face:ot_color_has_png()) assert.are_equal(true,f:ot_color_has_png()) end) + it("can check SVG glyph support", function() + local f = harfbuzz.Face.new('fonts/TwitterColorEmoji-SVGinOT.ttf') + assert.are_equal(false,face:ot_color_has_svg()) + assert.are_equal(true,f:ot_color_has_svg()) + end) + + it("can return glyph color png", function() + local f = harfbuzz.Face.new('fonts/TwitterColorEmoji-SVGinOT.ttf') + + assert.are_equal(nil,face:ot_color_glyph_get_svg(100)) + assert.are_equal(nil,f:ot_color_glyph_get_svg(0)) + assert.are_same(751,f:ot_color_glyph_get_svg(5):get_length()) + assert.are_same(804,f:ot_color_glyph_get_svg(6):get_length()) + assert.are_same("",f:ot_color_glyph_get_svg(5):get_data():sub(1, 38)) + end) + it("can return script tags", function() local t local tags = { @@ -320,6 +336,30 @@ describe("harfbuzz module", function() local f = harfbuzz.Feature.new(fs) assert.are_equal(fs, tostring(f)) end) + + it("has visible fields", function() + local f = harfbuzz.Feature.new('-kern') + print(getmetatable(f).__index) + assert.are_equal(tostring(f.tag), 'kern') + assert.are_equal(f.value, 0) + assert.are_equal(f.start, nil) + assert.are_equal(f._end, nil) + + f = harfbuzz.Feature.new('aalt[3:5]=4') + assert.are_equal(tostring(f.tag), 'aalt') + assert.are_equal(f.value, 4) + assert.are_equal(f.start, 3) + assert.are_equal(f._end, 5) + end) + + it("has editable fields", function() + local f = harfbuzz.Feature.new('-kern') + f.tag, f.value, f.start, f._end = harfbuzz.Tag.new"aalt", 4, 3, 5 + assert.are_equal(tostring(f), "aalt[3:5]=4") + + f.tag, f.value, f.start, f._end = harfbuzz.Tag.new"harf", 0, nil, nil + assert.are_equal(tostring(f), "-harf") + end) end) describe("harfbuzz.Tag", function() diff --git a/Build/source/texk/web2c/luatexdir/luaharfbuzz/src/harfbuzz.luadoc b/Build/source/texk/web2c/luatexdir/luaharfbuzz/src/harfbuzz.luadoc index 3b11636fae9..3a30a03c904 100644 --- a/Build/source/texk/web2c/luatexdir/luaharfbuzz/src/harfbuzz.luadoc +++ b/Build/source/texk/web2c/luatexdir/luaharfbuzz/src/harfbuzz.luadoc @@ -1,8 +1,8 @@ ----------- -- Lua bindings to Harfbuzz. --- * [Wiki](http://github.com/deepakjois/luaharfbuzz/wiki) --- * [Source on Github](https://github.com/deepakjois/luaharfbuzz) --- * [API Coverage Status](https://github.com/deepakjois/luaharfbuzz/blob/master/status/done.txt) +-- * [Wiki](http://github.com/ufytex/luaharfbuzz/wiki) +-- * [Source on Github](https://github.com/ufytex/luaharfbuzz) +-- * [API Coverage Status](https://github.com/ufytex/luaharfbuzz/blob/master/status/done.txt) -- -- @author Deepak Jois <> -- @copyright 2016 @@ -23,7 +23,7 @@ -- * `script`: A `Script` object representing the script. -- * `language`: A `Language` object representing the language. -- * `features`: features to enable, specified as either of the following. --- - comma-separated list of features. See [feature string syntax reference](https://github.com/deepakjois/luaharfbuzz/wiki/Feature-Strings) +-- - comma-separated list of features. See [feature string syntax reference](https://github.com/ufytex/luaharfbuzz/wiki/Feature-Strings) -- - table of `Feature` objects -- @function shape @@ -291,7 +291,7 @@ -- @type Feature --- Wraps `hb_feature_from_string` --- @param feature_string See [feature string syntax reference](https://github.com/deepakjois/luaharfbuzz/wiki/Feature-Strings) +-- @param feature_string See [feature string syntax reference](https://github.com/ufytex/luaharfbuzz/wiki/Feature-Strings) -- @function Feature.new --- Wraps `hb_feature_to_string`. diff --git a/Build/source/texk/web2c/luatexdir/luaharfbuzz/src/luaharfbuzz/buffer.c b/Build/source/texk/web2c/luatexdir/luaharfbuzz/src/luaharfbuzz/buffer.c index 11f803693fd..4eb78ec7a9a 100644 --- a/Build/source/texk/web2c/luatexdir/luaharfbuzz/src/luaharfbuzz/buffer.c +++ b/Build/source/texk/web2c/luatexdir/luaharfbuzz/src/luaharfbuzz/buffer.c @@ -1,27 +1,20 @@ #include "luaharfbuzz.h" #ifdef LuajitTeX -static void lua_len (lua_State *L, int i) { - switch (lua_type(L, i)) { - case LUA_TSTRING: - lua_pushnumber(L, (lua_Number)lua_objlen(L, i)); - break; - case LUA_TTABLE: - if (!luaL_callmeta(L, i, "__len")) - lua_pushnumber(L, (lua_Number)lua_objlen(L, i)); - break; - case LUA_TUSERDATA: - if (luaL_callmeta(L, i, "__len")) - break; - /* FALLTHROUGH */ - default: - luaL_error(L, "attempt to get length of a %s value", - lua_typename(L, lua_type(L, i))); - } + +static int lua_absindex (lua_State *L, int i) { + if (i < 0 && i > LUA_REGISTRYINDEX) + i += lua_gettop(L) + 1; + return i; +} +static int lua_geti (lua_State *L, int index, lua_Integer i) { + index = lua_absindex(L, index); + lua_pushinteger(L, i); + lua_gettable(L, index); + return lua_type(L, -1); } #endif - static int buffer_new(lua_State *L) { Buffer *b; @@ -59,6 +52,22 @@ static int buffer_set_direction(lua_State *L) { return 0; } +static int buffer_get_flags(lua_State *L) { + Buffer *b = (Buffer *)luaL_checkudata(L, 1, "harfbuzz.Buffer"); + + lua_pushinteger(L, hb_buffer_get_flags(*b)); + return 1; +} + +static int buffer_set_flags(lua_State *L) { + Buffer *b = (Buffer *)luaL_checkudata(L, 1, "harfbuzz.Buffer"); + + unsigned int l = luaL_checkinteger(L, 2); + + hb_buffer_set_flags(*b, l); + return 0; +} + static int buffer_get_language(lua_State *L) { Buffer *b = (Buffer *)luaL_checkudata(L, 1, "harfbuzz.Buffer"); @@ -97,25 +106,56 @@ static int buffer_set_script(lua_State *L) { return 0; } +static int buffer_get_invisible_glyph(lua_State *L) { + Buffer *b = (Buffer *)luaL_checkudata(L, 1, "harfbuzz.Buffer"); + + lua_pushinteger(L, hb_buffer_get_invisible_glyph(*b)); + return 1; +} + +static int buffer_set_invisible_glyph(lua_State *L) { + Buffer *b = (Buffer *)luaL_checkudata(L, 1, "harfbuzz.Buffer"); + + hb_codepoint_t cp = (hb_codepoint_t) luaL_checkinteger(L, 2); + + hb_buffer_set_invisible_glyph(*b, cp); + return 0; +} + +static int buffer_get_replacement_codepoint(lua_State *L) { + Buffer *b = (Buffer *)luaL_checkudata(L, 1, "harfbuzz.Buffer"); + + lua_pushinteger(L, hb_buffer_get_replacement_codepoint(*b)); + return 1; +} + +static int buffer_set_replacement_codepoint(lua_State *L) { + Buffer *b = (Buffer *)luaL_checkudata(L, 1, "harfbuzz.Buffer"); + + hb_codepoint_t cp = (hb_codepoint_t) luaL_checkinteger(L, 2); + + hb_buffer_set_replacement_codepoint(*b, cp); + return 0; +} + static int buffer_add_codepoints(lua_State *L) { Buffer *b = (Buffer *)luaL_checkudata(L, 1, "harfbuzz.Buffer"); unsigned int item_offset; int item_length; + int i; luaL_checktype(L, 2, LUA_TTABLE); item_offset = luaL_optinteger(L, 3, 0); item_length = luaL_optinteger(L, 4, -1); - lua_len (L, 2); - unsigned int n = luaL_checkinteger(L, -1); - lua_pop(L, 1); + int n = lua_rawlen(L, 2); hb_codepoint_t *text = (hb_codepoint_t *) malloc(n * sizeof(hb_codepoint_t)); - lua_pushnil(L); int i = 0; - while (lua_next(L, 2) != 0) { + for (i = 0; i != n; ++i) { + lua_geti(L, 2, i + 1); hb_codepoint_t c = (hb_codepoint_t) luaL_checkinteger(L, -1); - text[i++] = c; + text[i] = c; lua_pop(L, 1); } @@ -126,6 +166,20 @@ static int buffer_add_codepoints(lua_State *L) { return 0; } +static int buffer_clear_contents(lua_State *L) { + Buffer *b = (Buffer *)luaL_checkudata(L, 1, "harfbuzz.Buffer"); + + hb_buffer_clear_contents(*b); + return 0; +} + +static int buffer_reset(lua_State *L) { + Buffer *b = (Buffer *)luaL_checkudata(L, 1, "harfbuzz.Buffer"); + + hb_buffer_reset(*b); + return 0; +} + static int buffer_add_utf8(lua_State *L) { Buffer *b = (Buffer *)luaL_checkudata(L, 1, "harfbuzz.Buffer"); const char *text; @@ -238,14 +292,22 @@ static const struct luaL_Reg buffer_methods[] = { { "__gc", buffer_destroy }, { "add_utf8", buffer_add_utf8 }, { "add_codepoints", buffer_add_codepoints }, + { "clear_contents", buffer_clear_contents }, { "set_direction", buffer_set_direction }, { "get_direction", buffer_get_direction }, + { "set_flags", buffer_set_flags }, + { "get_flags", buffer_get_flags }, { "set_language", buffer_set_language }, { "get_language", buffer_get_language }, { "set_script", buffer_set_script }, { "get_script", buffer_get_script }, + { "set_invisible_glyph", buffer_set_invisible_glyph }, + { "get_invisible_glyph", buffer_get_invisible_glyph }, + { "set_replacement_codepoint", buffer_set_replacement_codepoint }, + { "get_replacement_codepoint", buffer_get_replacement_codepoint }, { "get_glyphs", buffer_get_glyphs }, { "guess_segment_properties", buffer_guess_segment_properties }, + { "reset", buffer_reset }, { "reverse", buffer_reverse }, { "get_length", buffer_get_length }, { "get_cluster_level", buffer_get_cluster_level }, @@ -264,6 +326,12 @@ static const struct luahb_constant_t buffer_constants[] = { { "CLUSTER_LEVEL_MONOTONE_CHARACTERS", HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS }, { "CLUSTER_LEVEL_CHARACTERS", HB_BUFFER_CLUSTER_LEVEL_CHARACTERS }, { "CLUSTER_LEVEL_DEFAULT", HB_BUFFER_CLUSTER_LEVEL_DEFAULT }, + { "FLAG_DEFAULT", HB_BUFFER_FLAG_DEFAULT }, + { "FLAG_BOT", HB_BUFFER_FLAG_BOT }, + { "FLAG_EOT", HB_BUFFER_FLAG_EOT }, + { "FLAG_PRESERVE_DEFAULT_IGNORABLES", HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES }, + { "FLAG_REMOVE_DEFAULT_IGNORABLES", HB_BUFFER_FLAG_REMOVE_DEFAULT_IGNORABLES }, + { "FLAG_DO_NOT_INSERT_DOTTED_CIRCLE", HB_BUFFER_FLAG_DO_NOT_INSERT_DOTTED_CIRCLE }, { "GLYPH_FLAG_UNSAFE_TO_BREAK", HB_GLYPH_FLAG_UNSAFE_TO_BREAK }, { "GLYPH_FLAG_DEFINED", HB_GLYPH_FLAG_DEFINED }, { NULL, 0 } diff --git a/Build/source/texk/web2c/luatexdir/luaharfbuzz/src/luaharfbuzz/face.c b/Build/source/texk/web2c/luatexdir/luaharfbuzz/src/luaharfbuzz/face.c index ddb05581fae..5538c704571 100644 --- a/Build/source/texk/web2c/luatexdir/luaharfbuzz/src/luaharfbuzz/face.c +++ b/Build/source/texk/web2c/luatexdir/luaharfbuzz/src/luaharfbuzz/face.c @@ -398,6 +398,31 @@ static int face_ot_color_has_png(lua_State *L) { return 1; } +static int face_ot_color_has_svg(lua_State *L) { + Face *f = (Face *)luaL_checkudata(L, 1, "harfbuzz.Face"); + + lua_pushboolean(L, hb_ot_color_has_svg(*f)); + return 1; +} + +static int face_ot_color_glyph_get_svg(lua_State *L) { + Face *f = (Face *)luaL_checkudata(L, 1, "harfbuzz.Face"); + hb_codepoint_t gid = (hb_codepoint_t) luaL_checkinteger(L, 2); + hb_blob_t* blob = hb_ot_color_glyph_reference_svg(*f, gid); + + if (hb_blob_get_length(blob) != 0) { + Blob *b = (Blob *)lua_newuserdata(L, sizeof(*b)); + luaL_getmetatable(L, "harfbuzz.Blob"); + lua_setmetatable(L, -2); + + *b = blob; + } else { + lua_pushnil(L); + } + + return 1; +} + static int face_destroy(lua_State *L) { Face *f = (Face *)luaL_checkudata(L, 1, "harfbuzz.Face"); @@ -419,6 +444,8 @@ static const struct luaL_Reg face_methods[] = { { "ot_color_has_layers", face_ot_color_has_layers }, { "ot_color_glyph_get_layers", face_ot_color_glyph_get_layers }, { "ot_color_has_png", face_ot_color_has_png }, + { "ot_color_has_svg", face_ot_color_has_svg }, + { "ot_color_glyph_get_svg", face_ot_color_glyph_get_svg }, { "ot_layout_get_script_tags", face_ot_layout_get_script_tags }, { "ot_layout_get_language_tags", face_ot_layout_get_language_tags }, { "ot_layout_get_feature_tags", face_ot_layout_get_feature_tags }, diff --git a/Build/source/texk/web2c/luatexdir/luaharfbuzz/src/luaharfbuzz/feature.c b/Build/source/texk/web2c/luatexdir/luaharfbuzz/src/luaharfbuzz/feature.c index 1a3cf0a7815..d6cd1ec325b 100644 --- a/Build/source/texk/web2c/luatexdir/luaharfbuzz/src/luaharfbuzz/feature.c +++ b/Build/source/texk/web2c/luatexdir/luaharfbuzz/src/luaharfbuzz/feature.c @@ -26,7 +26,63 @@ static int feature_to_string(lua_State *L) { return 1; } +static const char *feature_tag_ptr; +static const char *feature_value_ptr; +static const char *feature_start_ptr; +static const char *feature_end_ptr; + +static int feature_index(lua_State *L) { + Feature* f = (Feature *)luaL_checkudata(L, 1, "harfbuzz.Feature"); + const char *key = lua_tostring(L, 2); + + if (key == feature_tag_ptr) { + Tag *tag = (Tag *)lua_newuserdata(L, sizeof(*tag)); + luaL_getmetatable(L, "harfbuzz.Tag"); + lua_setmetatable(L, -2); + *tag = f->tag; + } else if (key == feature_value_ptr) { + lua_pushinteger(L, f->value); + } else if (key == feature_start_ptr) { + if (f->start == HB_FEATURE_GLOBAL_START) + lua_pushnil(L); + else + lua_pushinteger(L, f->start); + } else if (key == feature_end_ptr) { + if (f->end == HB_FEATURE_GLOBAL_END) + lua_pushnil(L); + else + lua_pushinteger(L, f->end); + } else { + lua_pushnil(L); + } + return 1; +} + +static int feature_newindex(lua_State *L) { + Feature* f = (Feature *)luaL_checkudata(L, 1, "harfbuzz.Feature"); + const char *key = lua_tostring(L, 2); + + if (key == feature_tag_ptr) { + f->tag = *(Tag *)luaL_checkudata(L, 3, "harfbuzz.Tag"); + } else if (key == feature_value_ptr) { + f->value = luaL_checkinteger(L, 3); + } else if (key == feature_start_ptr) { + if (lua_toboolean(L, 3)) + f->start = luaL_checkinteger(L, 3); + else + f->start = HB_FEATURE_GLOBAL_START; + } else if (key == feature_end_ptr) { + if (lua_toboolean(L, 3)) + f->end = luaL_checkinteger(L, 3); + else + f->end = HB_FEATURE_GLOBAL_END; + } + return 0; +} + static const struct luaL_Reg feature_methods[] = { + { "__index", feature_index }, + { "__newindex", feature_newindex }, { "__tostring", feature_to_string }, { NULL, NULL }, }; @@ -37,5 +93,18 @@ static const struct luaL_Reg feature_functions[] = { }; int register_feature(lua_State *L) { + lua_pushliteral(L, "tag"); + feature_tag_ptr = lua_tostring(L, -1); + (void) luaL_ref (L, LUA_REGISTRYINDEX); + lua_pushliteral(L, "value"); + feature_value_ptr = lua_tostring(L, -1); + (void) luaL_ref (L, LUA_REGISTRYINDEX); + lua_pushliteral(L, "start"); + feature_start_ptr = lua_tostring(L, -1); + (void) luaL_ref (L, LUA_REGISTRYINDEX); + lua_pushliteral(L, "_end"); /* _end instead of end to avoid Lua keyword */ + feature_end_ptr = lua_tostring(L, -1); + (void) luaL_ref (L, LUA_REGISTRYINDEX); + return register_class(L, "harfbuzz.Feature", feature_methods, feature_functions, NULL); } diff --git a/Build/source/texk/web2c/luatexdir/luaharfbuzz/src/luaharfbuzz/font.c b/Build/source/texk/web2c/luatexdir/luaharfbuzz/src/luaharfbuzz/font.c index 2c59ce55a67..c601673647e 100644 --- a/Build/source/texk/web2c/luatexdir/luaharfbuzz/src/luaharfbuzz/font.c +++ b/Build/source/texk/web2c/luatexdir/luaharfbuzz/src/luaharfbuzz/font.c @@ -184,7 +184,7 @@ static int font_ot_color_glyph_get_png(lua_State *L) { luaL_getmetatable(L, "harfbuzz.Blob"); lua_setmetatable(L, -2); - *b = hb_ot_color_glyph_reference_png(*f, gid); + *b = blob; } else { lua_pushnil(L); } diff --git a/Build/source/texk/web2c/luatexdir/luaharfbuzz/src/luaharfbuzz/luaharfbuzz.c b/Build/source/texk/web2c/luatexdir/luaharfbuzz/src/luaharfbuzz/luaharfbuzz.c index c41a46bb7e9..ac7081f0183 100644 --- a/Build/source/texk/web2c/luatexdir/luaharfbuzz/src/luaharfbuzz/luaharfbuzz.c +++ b/Build/source/texk/web2c/luatexdir/luaharfbuzz/src/luaharfbuzz/luaharfbuzz.c @@ -1,30 +1,42 @@ #include "luaharfbuzz.h" +#ifdef LuajitTeX +static int lua_absindex (lua_State *L, int i) { + if (i < 0 && i > LUA_REGISTRYINDEX) + i += lua_gettop(L) + 1; + return i; +} +static int lua_geti (lua_State *L, int index, lua_Integer i) { + index = lua_absindex(L, index); + lua_pushinteger(L, i); + lua_gettable(L, index); + return lua_type(L, -1); +} +#endif int shape_full (lua_State *L) { - int i = 0; Font *font = (Font *)luaL_checkudata(L, 1, "harfbuzz.Font"); Buffer *buf = (Buffer *)luaL_checkudata(L, 2, "harfbuzz.Buffer"); + unsigned int i; luaL_checktype(L, 3, LUA_TTABLE); luaL_checktype(L, 4, LUA_TTABLE); unsigned int num_features = lua_rawlen(L, 3); Feature *features = (Feature *) malloc (num_features * sizeof(hb_feature_t)); - lua_pushnil(L); - while (lua_next(L, 3) != 0) { + for (i = 0; i != num_features; ++i) { + lua_geti(L, 3, i + 1); Feature* f = (Feature *)luaL_checkudata(L, -1, "harfbuzz.Feature"); - features[i++] = *f; + features[i] = *f; lua_pop(L, 1); } const char **shapers = NULL; size_t num_shapers = lua_rawlen(L, 4); if (num_shapers) { - i = 0; shapers = (const char**) calloc (num_shapers + 1, sizeof(char*)); - lua_pushnil(L); - while (lua_next(L, 4) != 0) { - shapers[i++] = luaL_checkstring(L, -1); + for (i = 0; i != num_shapers; ++i) { + lua_geti(L, 4, i + 1); + shapers[i] = luaL_checkstring(L, -1); lua_pop(L, 1); } } diff --git a/Build/source/texk/web2c/luatexdir/luaharfbuzz/status/full_api.txt b/Build/source/texk/web2c/luatexdir/luaharfbuzz/status/full_api.txt index d68c9b0f239..3b6728fcefb 100644 --- a/Build/source/texk/web2c/luatexdir/luaharfbuzz/status/full_api.txt +++ b/Build/source/texk/web2c/luatexdir/luaharfbuzz/status/full_api.txt @@ -1,4 +1,12 @@ +hb_aat_layout_feature_type_get_name_id +hb_aat_layout_feature_type_get_selector_infos +hb_aat_layout_get_feature_types +hb_aat_layout_has_positioning +hb_aat_layout_has_substitution +hb_aat_layout_has_tracking +hb_blob_copy_writable_or_fail hb_blob_create +hb_blob_create_from_file hb_blob_create_sub_blob hb_blob_destroy hb_blob_get_data @@ -17,10 +25,12 @@ hb_buffer_add_utf16 hb_buffer_add_utf32 hb_buffer_add_utf8 hb_buffer_allocation_successful +hb_buffer_append hb_buffer_clear_contents hb_buffer_create hb_buffer_deserialize_glyphs hb_buffer_destroy +hb_buffer_diff hb_buffer_get_cluster_level hb_buffer_get_content_type hb_buffer_get_direction @@ -28,6 +38,7 @@ hb_buffer_get_empty hb_buffer_get_flags hb_buffer_get_glyph_infos hb_buffer_get_glyph_positions +hb_buffer_get_invisible_glyph hb_buffer_get_language hb_buffer_get_length hb_buffer_get_replacement_codepoint @@ -51,6 +62,7 @@ hb_buffer_set_cluster_level hb_buffer_set_content_type hb_buffer_set_direction hb_buffer_set_flags +hb_buffer_set_invisible_glyph hb_buffer_set_language hb_buffer_set_length hb_buffer_set_message_func @@ -59,17 +71,25 @@ hb_buffer_set_script hb_buffer_set_segment_properties hb_buffer_set_unicode_funcs hb_buffer_set_user_data -hb_coretext_face_create -hb_coretext_face_get_cg_font -hb_coretext_font_get_ct_font +hb_color_get_alpha +hb_color_get_blue +hb_color_get_green +hb_color_get_red hb_direction_from_string hb_direction_to_string +hb_face_builder_add_table +hb_face_builder_create +hb_face_collect_unicodes +hb_face_collect_variation_selectors +hb_face_collect_variation_unicodes +hb_face_count hb_face_create hb_face_create_for_tables hb_face_destroy hb_face_get_empty hb_face_get_glyph_count hb_face_get_index +hb_face_get_table_tags hb_face_get_upem hb_face_get_user_data hb_face_is_immutable @@ -101,13 +121,16 @@ hb_font_funcs_set_glyph_extents_func hb_font_funcs_set_glyph_from_name_func hb_font_funcs_set_glyph_func hb_font_funcs_set_glyph_h_advance_func +hb_font_funcs_set_glyph_h_advances_func hb_font_funcs_set_glyph_h_kerning_func hb_font_funcs_set_glyph_h_origin_func hb_font_funcs_set_glyph_name_func hb_font_funcs_set_glyph_v_advance_func +hb_font_funcs_set_glyph_v_advances_func hb_font_funcs_set_glyph_v_kerning_func hb_font_funcs_set_glyph_v_origin_func hb_font_funcs_set_nominal_glyph_func +hb_font_funcs_set_nominal_glyphs_func hb_font_funcs_set_user_data hb_font_funcs_set_variation_glyph_func hb_font_get_empty @@ -115,29 +138,33 @@ hb_font_get_extents_for_direction hb_font_get_face hb_font_get_glyph hb_font_get_glyph_advance_for_direction +hb_font_get_glyph_advances_for_direction hb_font_get_glyph_contour_point hb_font_get_glyph_contour_point_for_origin hb_font_get_glyph_extents hb_font_get_glyph_extents_for_origin hb_font_get_glyph_from_name hb_font_get_glyph_h_advance +hb_font_get_glyph_h_advances hb_font_get_glyph_h_kerning hb_font_get_glyph_h_origin hb_font_get_glyph_kerning_for_direction hb_font_get_glyph_name hb_font_get_glyph_origin_for_direction hb_font_get_glyph_v_advance +hb_font_get_glyph_v_advances hb_font_get_glyph_v_kerning hb_font_get_glyph_v_origin hb_font_get_h_extents hb_font_get_nominal_glyph hb_font_get_parent hb_font_get_ppem +hb_font_get_ptem hb_font_get_scale hb_font_get_user_data -hb_font_get_v_extents hb_font_get_var_coords_normalized hb_font_get_variation_glyph +hb_font_get_v_extents hb_font_glyph_from_string hb_font_glyph_to_string hb_font_is_immutable @@ -148,6 +175,7 @@ hb_font_set_funcs hb_font_set_funcs_data hb_font_set_parent hb_font_set_ppem +hb_font_set_ptem hb_font_set_scale hb_font_set_user_data hb_font_set_var_coords_design @@ -157,6 +185,7 @@ hb_font_subtract_glyph_origin_for_direction hb_ft_face_create hb_ft_face_create_cached hb_ft_face_create_referenced +hb_ft_font_changed hb_ft_font_create hb_ft_font_create_referenced hb_ft_font_get_face @@ -167,15 +196,80 @@ hb_glib_blob_create hb_glib_get_unicode_funcs hb_glib_script_from_script hb_glib_script_to_script -hb_icu_get_unicode_funcs -hb_icu_script_from_script -hb_icu_script_to_script +hb_glyph_info_get_glyph_flags +hb_gobject_aat_layout_feature_selector_get_type +hb_gobject_aat_layout_feature_type_get_type +hb_gobject_blob_get_type +hb_gobject_buffer_cluster_level_get_type +hb_gobject_buffer_content_type_get_type +hb_gobject_buffer_diff_flags_get_type +hb_gobject_buffer_flags_get_type +hb_gobject_buffer_get_type +hb_gobject_buffer_serialize_flags_get_type +hb_gobject_buffer_serialize_format_get_type +hb_gobject_direction_get_type +hb_gobject_face_get_type +hb_gobject_feature_get_type +hb_gobject_font_funcs_get_type +hb_gobject_font_get_type +hb_gobject_glyph_flags_get_type +hb_gobject_glyph_info_get_type +hb_gobject_glyph_position_get_type +hb_gobject_map_get_type +hb_gobject_memory_mode_get_type +hb_gobject_ot_color_palette_flags_get_type +hb_gobject_ot_layout_glyph_class_get_type +hb_gobject_ot_math_constant_get_type +hb_gobject_ot_math_glyph_part_flags_get_type +hb_gobject_ot_math_glyph_part_get_type +hb_gobject_ot_math_glyph_variant_get_type +hb_gobject_ot_math_kern_get_type +hb_gobject_ot_var_axis_flags_get_type +hb_gobject_script_get_type +hb_gobject_segment_properties_get_type +hb_gobject_set_get_type +hb_gobject_shape_plan_get_type +hb_gobject_unicode_combining_class_get_type +hb_gobject_unicode_funcs_get_type +hb_gobject_unicode_general_category_get_type +hb_gobject_user_data_key_get_type +hb_graphite2_face_get_gr_face +hb_graphite2_font_get_gr_font hb_language_from_string hb_language_get_default hb_language_to_string +hb_map_allocation_successful +hb_map_clear +hb_map_create +hb_map_del +hb_map_destroy +hb_map_get +hb_map_get_empty +hb_map_get_population +hb_map_get_user_data +hb_map_has +hb_map_is_empty +hb_map_reference +hb_map_set +hb_map_set_user_data +hb_ot_color_glyph_get_layers +hb_ot_color_glyph_reference_png +hb_ot_color_glyph_reference_svg +hb_ot_color_has_layers +hb_ot_color_has_palettes +hb_ot_color_has_png +hb_ot_color_has_svg +hb_ot_color_palette_color_get_name_id +hb_ot_color_palette_get_colors +hb_ot_color_palette_get_count +hb_ot_color_palette_get_flags +hb_ot_color_palette_get_name_id hb_ot_font_set_funcs +hb_ot_layout_collect_features hb_ot_layout_collect_lookups +hb_ot_layout_feature_get_characters hb_ot_layout_feature_get_lookups +hb_ot_layout_feature_get_name_ids hb_ot_layout_feature_with_variations_get_lookups hb_ot_layout_get_attach_points hb_ot_layout_get_glyph_class @@ -191,16 +285,19 @@ hb_ot_layout_language_get_feature_tags hb_ot_layout_language_get_required_feature hb_ot_layout_language_get_required_feature_index hb_ot_layout_lookup_collect_glyphs +hb_ot_layout_lookups_substitute_closure hb_ot_layout_lookup_substitute_closure hb_ot_layout_lookup_would_substitute hb_ot_layout_script_find_language hb_ot_layout_script_get_language_tags +hb_ot_layout_script_select_language hb_ot_layout_table_choose_script hb_ot_layout_table_find_feature_variations hb_ot_layout_table_find_script hb_ot_layout_table_get_feature_tags hb_ot_layout_table_get_lookup_count hb_ot_layout_table_get_script_tags +hb_ot_layout_table_select_script hb_ot_math_get_constant hb_ot_math_get_glyph_assembly hb_ot_math_get_glyph_italics_correction @@ -210,16 +307,28 @@ hb_ot_math_get_glyph_variants hb_ot_math_get_min_connector_overlap hb_ot_math_has_data hb_ot_math_is_glyph_extended_shape +hb_ot_name_get_utf16 +hb_ot_name_get_utf32 +hb_ot_name_get_utf8 +hb_ot_name_list_names hb_ot_shape_glyphs_closure hb_ot_shape_plan_collect_lookups hb_ot_tag_from_language +hb_ot_tags_from_script +hb_ot_tags_from_script_and_language +hb_ot_tags_to_script_and_language hb_ot_tag_to_language hb_ot_tag_to_script -hb_ot_tags_from_script hb_ot_var_find_axis +hb_ot_var_find_axis_info hb_ot_var_get_axes hb_ot_var_get_axis_count +hb_ot_var_get_axis_infos +hb_ot_var_get_named_instance_count hb_ot_var_has_data +hb_ot_var_named_instance_get_design_coords +hb_ot_var_named_instance_get_postscript_name_id +hb_ot_var_named_instance_get_subfamily_name_id hb_ot_var_normalize_coords hb_ot_var_normalize_variations hb_script_from_iso15924_tag @@ -246,8 +355,11 @@ hb_set_intersect hb_set_invert hb_set_is_empty hb_set_is_equal +hb_set_is_subset hb_set_next hb_set_next_range +hb_set_previous +hb_set_previous_range hb_set_reference hb_set_set hb_set_set_user_data @@ -268,6 +380,20 @@ hb_shape_plan_get_shaper hb_shape_plan_get_user_data hb_shape_plan_reference hb_shape_plan_set_user_data +hb_subset +hb_subset_input_create_or_fail +hb_subset_input_destroy +hb_subset_input_drop_tables_set +hb_subset_input_get_desubroutinize +hb_subset_input_get_drop_hints +hb_subset_input_get_retain_gids +hb_subset_input_glyph_set +hb_subset_input_nameid_set +hb_subset_input_reference +hb_subset_input_set_desubroutinize +hb_subset_input_set_drop_hints +hb_subset_input_set_retain_gids +hb_subset_input_unicode_set hb_tag_from_string hb_tag_to_string hb_unicode_combining_class -- cgit v1.2.3