Skip to content
This repository has been archived by the owner on Jun 4, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' into releases
Browse files Browse the repository at this point in the history
  • Loading branch information
be5invis committed Jul 31, 2016
2 parents 8d1d2cf + f848107 commit edc6f97
Show file tree
Hide file tree
Showing 16 changed files with 287 additions and 73 deletions.
2 changes: 2 additions & 0 deletions dep/premake-modules/xcode-alt/xcode-alt.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
include("xcode_common.lua")
include("xcode4_workspace.lua")
include("xcode_project.lua")
include("xcode_scheme.lua")

newaction {
trigger = "xcode4",
Expand All @@ -41,6 +42,7 @@

onProject = function(prj)
p.generate(prj, ".xcodeproj/project.pbxproj", p.modules.xcode_alt.generateProject)
p.generate(prj, ".xcodeproj/xcshareddata/xcschemes/" .. prj.name .. ".xcscheme", p.modules.xcode_alt.scheme.generate)
end,
}

Expand Down
7 changes: 5 additions & 2 deletions dep/premake-modules/xcode-alt/xcode_common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,9 @@
return types[node.cfg.kind]
end

function xcode.printSettingsTable(level, settings)
printSettingsTable(level, settings)
end

--
-- Return a unique file name for a project. Since Xcode uses .xcodeproj's to
Expand Down Expand Up @@ -368,7 +371,7 @@
local settings = {};
tree.traverse(tr, {
onnode = function(node)
if node.buildid then
if node.buildid and (not node.not_a_link_dependency) then
settings[node.buildid] = function(level)
_p(level,'%s /* %s in %s */ = {isa = PBXBuildFile; fileRef = %s /* %s */; };',
node.buildid, node.name, xcode.getbuildcategory(node), node.id, node.name)
Expand Down Expand Up @@ -529,7 +532,7 @@
-- write out project dependencies
tree.traverse(tr.projects, {
onleaf = function(node)
if node.buildid then
if node.buildid and not node.not_a_link_dependency then
_p(4,'%s /* %s in Frameworks */,', node.buildid, node.name)
end
end
Expand Down
75 changes: 38 additions & 37 deletions dep/premake-modules/xcode-alt/xcode_project.lua
Original file line number Diff line number Diff line change
Expand Up @@ -87,49 +87,50 @@
tr.products = tree.insert(tr, tree.new("Products"))

-- the special folder "Projects" lists sibling project dependencies
tr.projects = tree.new("Projects")
for _, dep in ipairs(project.getdependencies(prj, "sibling", "object")) do
-- create a child node for the dependency's xcodeproj
local xcpath = xcode.getxcodeprojname(dep)
local xcnode = tree.insert(tr.projects, tree.new(path.getname(xcpath)))
xcnode.path = xcpath
xcnode.project = dep
xcnode.productgroupid = xcode.newid(xcnode.name, "prodgrp")
xcnode.productproxyid = xcode.newid(xcnode.name, "prodprox")
xcnode.targetproxyid = xcode.newid(xcnode.name, "targprox")
xcnode.targetdependid = xcode.newid(xcnode.name, "targdep")
tr.projects = tree.new("Projects")
for _, dep in ipairs(project.getdependencies(prj)) do
-- create a child node for the dependency's xcodeproj
local xcpath = xcode.getxcodeprojname(dep)
local xcnode = tree.insert(tr.projects, tree.new(path.getname(xcpath)))
xcnode.path = xcpath
xcnode.project = dep
xcnode.productgroupid = xcode.newid(xcnode.name, "prodgrp")
xcnode.productproxyid = xcode.newid(xcnode.name, "prodprox")
xcnode.targetproxyid = xcode.newid(xcnode.name, "targprox")
xcnode.targetdependid = xcode.newid(xcnode.name, "targdep")
xcnode.not_a_link_dependency = not table.contains(project.getdependencies(prj, "linkOnly"), dep)

-- create a grandchild node for the dependency's link target
local lprj = premake.workspace.findproject(prj.workspace, dep.name)
local cfg = project.findClosestMatch(lprj, prj.configurations[1])
node = tree.insert(xcnode, tree.new(cfg.linktarget.name))
node.path = cfg.linktarget.fullpath
node.cfg = cfg
local lprj = premake.workspace.findproject(prj.workspace, dep.name)
local cfg = project.findClosestMatch(lprj, prj.configurations[1])
node = tree.insert(xcnode, tree.new(cfg.linktarget.name))
node.path = cfg.linktarget.fullpath
node.cfg = cfg
node.not_a_link_dependency = xcnode.not_a_link_dependency
end

if #tr.projects.children > 0 then
tree.insert(tr, tr.projects)
end
if #tr.projects.children > 0 then
tree.insert(tr, tr.projects)
end

-- Final setup
tree.traverse(tr, {
onnode = function(node)
-- assign IDs to every node in the tree
node.id = xcode.newid(node.name, nil, node.path)

node.isResource = xcode.isItemResource(prj, node)

-- assign build IDs to buildable files
if xcode.getbuildcategory(node) then
node.buildid = xcode.newid(node.name, "build", node.path)
end

-- remember key files that are needed elsewhere
if string.endswith(node.name, "Info.plist") then
tr.infoplist = node
end
end
}, true)
tree.traverse(tr, {
onnode = function(node)
-- assign IDs to every node in the tree
node.id = xcode.newid(node.name, nil, node.path)
node.isResource = xcode.isItemResource(prj, node)

-- assign build IDs to buildable files
if xcode.getbuildcategory(node) then
node.buildid = xcode.newid(node.name, "build", node.path)
end

-- remember key files that are needed elsewhere
if string.endswith(node.name, "Info.plist") then
tr.infoplist = node
end
end
}, true)

-- Plug in the product node into the Products folder in the tree. The node
-- was built in xcode.prepareWorkspace() in xcode_common.lua; it contains IDs
Expand Down
139 changes: 139 additions & 0 deletions dep/premake-modules/xcode-alt/xcode_scheme.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
---
-- xcode/xcode4_scheme.lua
-- Generate a shared scheme for an Xcode C/C++ project.
-- Copyright (c) 2009-2016 Jason Perkins and the Premake project
---

local p = premake
local m = p.modules.xcode_alt

local project = p.project
local config = p.config
local fileconfig = p.fileconfig
local tree = p.tree

m.scheme = {}
local scheme = m.scheme

function scheme.Header(prj)
p.w('<?xml version="1.0" encoding="UTF-8"?>')
p.push('<Scheme')
p.w('LastUpgradeVersion = "0500"')
p.w('version = "1.3">')
end

function scheme.Footer(prj)
p.pop('</Scheme>')
end

function scheme.buildablereference(prj)
local tr = project.getsourcetree(prj)
for _, node in ipairs(tr.products.children) do
p.push('<BuildableReference')
p.w('BuildableIdentifier = "primary"')
p.w('BlueprintIdentifier = "%s"', node.targetid)
p.w('BuildableName = "%s"', node.name)
p.w('BlueprintName = "%s"', tr.name)
p.w('ReferencedContainer = "container:%s.xcodeproj">', tr.name)
p.pop('</BuildableReference>')
end
end

function scheme.build(prj)
p.push('<BuildAction')
p.w('parallelizeBuildables = "YES"')
p.w('buildImplicitDependencies = "YES">')
p.push('<BuildActionEntries>')
p.push('<BuildActionEntry')
p.w('buildForTesting = "YES"')
p.w('buildForRunning = "YES"')
p.w('buildForProfiling = "YES"')
p.w('buildForArchiving = "YES"')
p.w('buildForAnalyzing = "YES">')
scheme.buildablereference(prj)
p.pop('</BuildActionEntry>')
p.pop('</BuildActionEntries>')
p.pop('</BuildAction>')
end

function scheme.test(prj)
p.push('<TestAction')
p.w('selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"')
p.w('selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"')
p.w('shouldUseLaunchSchemeArgsEnv = "YES"')
p.w('buildConfiguration = "Debug">')
p.push('<Testables>')
p.pop('</Testables>')
p.push('<MacroExpansion>')
scheme.buildablereference(prj)
p.pop('</MacroExpansion>')
p.pop('</TestAction>')
end

function scheme.launch(prj)
p.push('<LaunchAction')
p.w('selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"')
p.w('selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"')
p.w('launchStyle = "0"')
p.w('useCustomWorkingDirectory = "NO"')
p.w('buildConfiguration = "Debug"')
p.w('ignoresPersistentStateOnLaunch = "NO"')
p.w('debugDocumentVersioning = "NO"')
p.w('allowLocationSimulation = "YES">')
p.push('<BuildableProductRunnable>')
scheme.buildablereference(prj)
p.pop('</BuildableProductRunnable>')
p.push('<AdditionalOptions>')
p.pop('</AdditionalOptions>')
p.pop('</LaunchAction>')
end

function scheme.profile(prj)
p.push('<ProfileAction')
p.w('shouldUseLaunchSchemeArgsEnv = "YES"')
p.w('savedToolIdentifier = ""')
p.w('useCustomWorkingDirectory = "NO"')
p.w('buildConfiguration = "Release"')
p.w('debugDocumentVersioning = "NO">')
p.push('<BuildableProductRunnable>')
scheme.buildablereference(prj)
p.pop('</BuildableProductRunnable>')
p.pop('</ProfileAction>')
end

function scheme.analyze(prj)
p.push('<AnalyzeAction')
p.w('buildConfiguration = "Debug">')
p.pop('</AnalyzeAction>')
end

function scheme.archive(prj)
p.push('<ArchiveAction')
p.w('buildConfiguration = "Release"')
p.w('revealArchiveInOrganizer = "YES">')
p.pop('</ArchiveAction>')
end

--
-- Generate the shared data scheme for an xcode project
--
-- @param prj
-- The Premake project to generate.
--

m.scheme.project = function(prj)
return {
scheme.Header,
scheme.build,
scheme.test,
scheme.launch,
scheme.profile,
scheme.analyze,
scheme.archive,
scheme.Footer,
}
end

function m.scheme.generate(prj)
p.callArray(m.scheme.project, prj)
end
26 changes: 17 additions & 9 deletions lib/font/caryll-font.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,17 @@ json_value *caryll_font_to_json(caryll_font *font, caryll_options *options) {
return root;
}

caryll_font_subtype caryll_decide_font_subtype_json(json_value *root) {
if (json_obj_get_type(root, "CFF_", json_object) != NULL) {
return FONTTYPE_CFF;
} else {
return FONTTYPE_TTF;
}
}
caryll_font *caryll_font_from_json(json_value *root, caryll_options *options) {
caryll_font *font = caryll_new_font();
if (!font) return NULL;
font->subtype = json_obj_get_type(root, "CFF_", json_object) != NULL;
font->subtype = caryll_decide_font_subtype_json(root);
font->glyph_order = caryll_glyphorder_from_json(root, options);
font->head = caryll_head_from_json(root, options);
font->hhea = caryll_hhea_from_json(root, options);
Expand Down Expand Up @@ -194,15 +201,16 @@ caryll_buffer *caryll_write_font(caryll_font *font, caryll_options *options) {
if (font->LTSH) sfnt_builder_push_table(builder, 'LTSH', caryll_write_LTSH(font->LTSH, options));
}

sfnt_builder_push_table(builder, 'hmtx',
caryll_write_hmtx(font->hmtx, font->hhea->numberOfMetrics,
font->maxp->numGlyphs - font->hhea->numberOfMetrics, options));

if (font->hhea && font->maxp && font->hmtx) {
uint16_t hmtx_counta = font->hhea->numberOfMetrics;
uint16_t hmtx_countk = font->maxp->numGlyphs - font->hhea->numberOfMetrics;
sfnt_builder_push_table(builder, 'hmtx', caryll_write_hmtx(font->hmtx, hmtx_counta, hmtx_countk, options));
}
if (font->vhea) sfnt_builder_push_table(builder, 'vhea', caryll_write_vhea(font->vhea, options));
if (font->vmtx) {
sfnt_builder_push_table(builder, 'vmtx',
caryll_write_vmtx(font->vmtx, font->vhea->numOfLongVerMetrics,
font->maxp->numGlyphs - font->vhea->numOfLongVerMetrics, options));
if (font->vhea && font->maxp && font->vmtx) {
uint16_t vmtx_counta = font->vhea->numOfLongVerMetrics;
uint16_t vmtx_countk = font->maxp->numGlyphs - font->vhea->numOfLongVerMetrics;
sfnt_builder_push_table(builder, 'vmtx', caryll_write_vmtx(font->vmtx, vmtx_counta, vmtx_countk, options));
}
if (font->VORG) { sfnt_builder_push_table(builder, 'VORG', caryll_write_VORG(font->VORG, options)); }

Expand Down
1 change: 1 addition & 0 deletions lib/font/caryll-font.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ struct _caryll_font {
};

caryll_font_subtype caryll_decide_font_subtype(caryll_sfnt *sfnt, uint32_t index);
caryll_font_subtype caryll_decide_font_subtype_json(json_value *root);
caryll_font *caryll_new_font();
caryll_font *caryll_read_font(caryll_sfnt *sfnt, uint32_t index);
void caryll_delete_font(caryll_font *font);
Expand Down
24 changes: 24 additions & 0 deletions lib/fontops/consolidate.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,30 @@ void caryll_font_consolidate_glyph(glyf_glyph *g, caryll_font *font) {
}
free(hmap);
free(vmap);
// Consolidate fdSelect
if (g->fdSelect.name && font->CFF_ && font->CFF_->fdArray) {
bool found = false;
for (uint16_t j = 0; j < font->CFF_->fdArrayCount; j++) {
if (strcmp(g->fdSelect.name, font->CFF_->fdArray[j]->fontName) == 0) {
found = true;
sdsfree(g->fdSelect.name);
g->fdSelect.name = font->CFF_->fdArray[j]->fontName;
g->fdSelect.index = j;
break;
}
}
if (!found) {
fprintf(stderr, "[Consolidate] CID Subfont %s is not defined. (in glyph /%s).\n", g->fdSelect.name,
g->name);
sdsfree(g->fdSelect.name);
g->fdSelect.name = NULL;
g->fdSelect.index = 0;
}
} else if (g->fdSelect.name) {
sdsfree(g->fdSelect.name);
g->fdSelect.name = NULL;
g->fdSelect.index = 0;
}
}

void caryll_font_consolidate_glyf(caryll_font *font) {
Expand Down
13 changes: 13 additions & 0 deletions lib/fontops/unconsolidate.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,18 @@ static void caryll_name_features(caryll_font *font) {
if (font->GDEF->ligCarets) { name_coverage(font, font->GDEF->ligCarets->coverage); }
}
}

static void caryll_name_fdselect(caryll_font *font) {
if (font->CFF_ && font->glyf && font->CFF_->fdArray) {
for (uint16_t j = 0; j < font->glyf->numberGlyphs; j++) {
glyf_glyph *g = font->glyf->glyphs[j];
if (g->fdSelect.index < font->CFF_->fdArrayCount) {
g->fdSelect.name = font->CFF_->fdArray[g->fdSelect.index]->fontName;
}
}
}
}

static void merge_hmtx(caryll_font *font) {
// Merge hmtx table into glyf.
if (font->hhea && font->hmtx && font->glyf) {
Expand Down Expand Up @@ -295,4 +307,5 @@ void caryll_font_unconsolidate(caryll_font *font, caryll_options *options) {
caryll_name_cmap_entries(font);
caryll_name_glyf(font);
caryll_name_features(font);
caryll_name_fdselect(font);
}
6 changes: 4 additions & 2 deletions lib/libcff/charstring_il.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ typedef enum {

typedef struct {
il_type type;
double d;
int32_t i;
uint16_t arity;
union {
double d; // for type == IL_ITEM_OPERAND, IL_ITEM_PHANTOM_OPERAND
int32_t i; // otherwise
};
} charstring_instruction;

typedef struct {
Expand Down
Loading

0 comments on commit edc6f97

Please sign in to comment.