@@ -11140,7 +11140,10 @@ context = {
1114011140local function format_mapping(mapping)
1114111141 local codepoint_desc = "[" .. utils.format_codepoint(mapping.codepoint) .. "]"
1114211142 if mapping.glyph then
11143- return "'" .. mapping.glyph .. "' " .. codepoint_desc
11143+ codepoint_desc = "'" .. mapping.glyph .. "' " .. codepoint_desc
11144+ end
11145+ if mapping.smuflFontName then
11146+ codepoint_desc = codepoint_desc .. "(" .. mapping.smuflFontName ..")"
1114411147 end
1114511148 return codepoint_desc
1114611149end
@@ -11184,11 +11187,29 @@ local function set_codepoint(control, codepoint)
1118411187 end
1118511188 control:SetText(fcstr)
1118611189end
11190+ local function on_smufl_popup(popup)
11191+ local dialog = popup:GetParent()
11192+ local smufl_box = dialog:GetControl("smufl_box")
11193+ local fcstr = finale.FCString()
11194+ popup:GetItemText(popup:GetSelectedItem(), fcstr)
11195+ smufl_box:SetFont(finale.FCFontInfo(fcstr.LuaString, 24))
11196+ end
1118711197local function on_popup(popup)
1118811198 local legacy_codepoint = context.popup_keys[popup:GetSelectedItem() + 1] or 0
1118911199 local current_mapping = legacy_codepoint > 0 and context.current_mapping[legacy_codepoint]
1119011200 local smufl_codepoint = current_mapping and current_mapping.codepoint or 0
1119111201 local dialog = popup:GetParent()
11202+ if current_mapping and current_mapping.smuflFontName then
11203+ local smufl_list = dialog:GetControl("smufl_list")
11204+ for index = 0, smufl_list:GetCount() - 1 do
11205+ local str = finale.FCString()
11206+ smufl_list:GetItemText(index, str)
11207+ if str.LuaString == current_mapping.smuflFontName then
11208+ smufl_list:SetSelectedItem(index)
11209+ on_smufl_popup(smufl_list)
11210+ end
11211+ end
11212+ end
1119211213 set_codepoint(dialog:GetControl("legacy_box"), legacy_codepoint)
1119311214 set_codepoint(dialog:GetControl("smufl_box"), smufl_codepoint)
1119411215end
@@ -11261,6 +11282,7 @@ local function on_select_file(control)
1126111282 t.glyph = glyph
1126211283 t.codepoint = utils.parse_codepoint(v.codepoint)
1126311284 t.nameIsMakeMusic = v.nameIsMakeMusic
11285+ t.smuflFontName = v.smuflFontName
1126411286 if t.codepoint == 0xFFFD then
1126511287 local smufl_box = dialog:GetControl("smufl_box")
1126611288 local _, info = smufl_glyphs.get_glyph_info(glyph, smufl_box:CreateFontInfo())
@@ -11294,13 +11316,6 @@ local function on_symbol_select(box)
1129411316 end
1129511317 enable_disable(dialog)
1129611318end
11297- local function on_smufl_popup(popup)
11298- local dialog = popup:GetParent()
11299- local smufl_box = dialog:GetControl("smufl_box")
11300- local fcstr = finale.FCString()
11301- popup:GetItemText(popup:GetSelectedItem(), fcstr)
11302- smufl_box:SetFont(finale.FCFontInfo(fcstr.LuaString, 24))
11303- end
1130411319local function on_add_mapping(control)
1130511320 local dialog = control:GetParent()
1130611321 local popup = dialog:GetControl("mappings")
@@ -11314,13 +11329,17 @@ local function on_add_mapping(control)
1131411329 return
1131511330 end
1131611331 end
11332+ local font = dialog:GetControl("smufl_box"):CreateFontInfo()
1131711333 current_mapping = {codepoint = smufl_point}
11318- local glyph, info = smufl_glyphs.get_glyph_info(smufl_point, dialog:GetControl("smufl_box"):CreateFontInfo() )
11334+ local glyph, info = smufl_glyphs.get_glyph_info(smufl_point, font )
1131911335 if info then
1132011336 current_mapping.glyph = glyph
1132111337 else
1132211338 current_mapping.glyph = utils.format_codepoint(smufl_point)
1132311339 end
11340+ if font and smufl_point >= 0xF400 and smufl_point <= 0xF8FF then
11341+ current_mapping.smuflFontName = font.Name
11342+ end
1132411343 context.current_mapping[legacy_point] = current_mapping
1132511344 update_popup(popup, legacy_point)
1132611345end
@@ -11353,6 +11372,9 @@ local function emit_json(mapping, reverse_lookup)
1135311372 else
1135411373 table.insert(parts, '\t\t"description": ' .. quote(""))
1135511374 end
11375+ if entry.smuflFontName then
11376+ table.insert(parts, '\t\t"smuflFontName": ' .. quote(entry.smuflFontName))
11377+ end
1135611378 return "{\n" .. table.concat(parts, ",\n") .. "\n\t}"
1135711379 end
1135811380 local lines = { "{" }
0 commit comments