-
Notifications
You must be signed in to change notification settings - Fork 664
Commit
- Loading branch information
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Flow } from '../src/flow.js'; | ||
import { loadBravura } from '../src/fonts/load_bravura.js'; | ||
import { loadCustom } from '../src/fonts/load_custom.js'; | ||
import { loadTextFonts } from '../src/fonts/textfonts.js'; | ||
loadBravura(); | ||
loadCustom(); | ||
Flow.setMusicFont('Bravura', 'Custom'); | ||
loadTextFonts(); | ||
export * from '../src/index.js'; | ||
export * as default from '../src/index.js'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
import { Flow } from '../src/flow.js'; | ||
import { Font } from '../src/font.js'; | ||
import { loadTextFonts } from '../src/fonts/textfonts.js'; | ||
import { globalObject, RuntimeError } from '../src/util.js'; | ||
const fontModules = { | ||
Bravura: './vexflow-font-bravura.js', | ||
Gonville: './vexflow-font-gonville.js', | ||
Petaluma: './vexflow-font-petaluma.js', | ||
Leland: './vexflow-font-leland.js', | ||
Custom: './vexflow-font-custom.js', | ||
}; | ||
Flow.fetchMusicFont = (fontName, fontModuleOrPath) => __awaiter(void 0, void 0, void 0, function* () { | ||
const font = Font.load(fontName); | ||
if (font.hasData()) { | ||
return; | ||
} | ||
if (!fontModuleOrPath) { | ||
if (fontName in fontModules) { | ||
fontModuleOrPath = fontModules[fontName]; | ||
} | ||
else { | ||
throw new RuntimeError('UnknownFont', `Music font ${fontName} does not exist.`); | ||
} | ||
} | ||
let fontModule; | ||
if (typeof fontModuleOrPath === 'string') { | ||
const module = yield import(fontModuleOrPath); | ||
const g = globalObject(); | ||
const VexFlowFont = g['VexFlowFont']; | ||
if (typeof VexFlowFont !== 'undefined' && typeof VexFlowFont[fontName] !== 'undefined') { | ||
fontModule = VexFlowFont[fontName]; | ||
} | ||
else { | ||
fontModule = module.Font; | ||
} | ||
} | ||
else { | ||
fontModule = fontModuleOrPath; | ||
} | ||
font.setData(fontModule.data); | ||
font.setMetrics(fontModule.metrics); | ||
}); | ||
loadTextFonts(); | ||
export * from '../src/index.js'; | ||
export * as default from '../src/index.js'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import * as VexSrc from '../src/index.js'; | ||
import * as VexTests from '../tests/index.js'; | ||
import { Flow } from '../src/flow.js'; | ||
import { loadAllMusicFonts } from '../src/fonts/load_all.js'; | ||
import { loadTextFonts } from '../src/fonts/textfonts.js'; | ||
loadAllMusicFonts(); | ||
Flow.setMusicFont('Bravura', 'Gonville', 'Custom'); | ||
loadTextFonts(); | ||
export * from '../src/index.js'; | ||
export * from '../tests/index.js'; | ||
export default Object.assign(Object.assign({}, VexSrc), VexTests); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Flow } from '../src/flow.js'; | ||
import { loadAllMusicFonts } from '../src/fonts/load_all.js'; | ||
import { loadTextFonts } from '../src/fonts/textfonts.js'; | ||
loadAllMusicFonts(); | ||
Flow.setMusicFont('Bravura', 'Gonville', 'Custom'); | ||
loadTextFonts(); | ||
export * from '../src/index.js'; | ||
export * as default from '../src/index.js'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { BravuraFont } from '../src/fonts/bravura_glyphs.js'; | ||
import { CommonMetrics } from '../src/fonts/common_metrics.js'; | ||
export const Font = { | ||
data: BravuraFont, | ||
metrics: CommonMetrics, | ||
}; | ||
export default Font; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { CommonMetrics } from '../src/fonts/common_metrics.js'; | ||
import { CustomFont } from '../src/fonts/custom_glyphs.js'; | ||
export const Font = { | ||
data: CustomFont, | ||
metrics: CommonMetrics, | ||
}; | ||
export default Font; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { CommonMetrics } from '../src/fonts/common_metrics.js'; | ||
import { GonvilleSmuflFont } from '../src/fonts/gonville_glyphs.js'; | ||
export const Font = { | ||
data: GonvilleSmuflFont, | ||
metrics: CommonMetrics, | ||
}; | ||
export default Font; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { CommonMetrics } from '../src/fonts/common_metrics.js'; | ||
import { LelandFont } from '../src/fonts/leland_glyphs.js'; | ||
export const Font = { | ||
data: LelandFont, | ||
metrics: CommonMetrics, | ||
}; | ||
export default Font; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { CommonMetrics } from '../src/fonts/common_metrics.js'; | ||
import { PetalumaFont } from '../src/fonts/petaluma_glyphs.js'; | ||
export const Font = { | ||
data: PetalumaFont, | ||
metrics: CommonMetrics, | ||
}; | ||
export default Font; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Flow } from '../src/flow.js'; | ||
import { loadCustom } from '../src/fonts/load_custom.js'; | ||
import { loadGonville } from '../src/fonts/load_gonville.js'; | ||
import { loadTextFonts } from '../src/fonts/textfonts.js'; | ||
loadGonville(); | ||
loadCustom(); | ||
Flow.setMusicFont('Gonville', 'Custom'); | ||
loadTextFonts(); | ||
export * from '../src/index.js'; | ||
export * as default from '../src/index.js'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Flow } from '../src/flow.js'; | ||
import { loadCustom } from '../src/fonts/load_custom.js'; | ||
import { loadLeland } from '../src/fonts/load_leland.js'; | ||
import { loadTextFonts } from '../src/fonts/textfonts.js'; | ||
loadLeland(); | ||
loadCustom(); | ||
Flow.setMusicFont('Leland', 'Custom'); | ||
loadTextFonts(); | ||
export * from '../src/index.js'; | ||
export * as default from '../src/index.js'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Flow } from '../src/flow.js'; | ||
import { loadCustom } from '../src/fonts/load_custom.js'; | ||
import { loadPetaluma } from '../src/fonts/load_petaluma.js'; | ||
import { loadTextFonts } from '../src/fonts/textfonts.js'; | ||
loadPetaluma(); | ||
loadCustom(); | ||
Flow.setMusicFont('Petaluma', 'Custom'); | ||
loadTextFonts(); | ||
export * from '../src/index.js'; | ||
export * as default from '../src/index.js'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Flow } from '../src/flow.js'; | ||
import { loadAllMusicFonts } from '../src/fonts/load_all.js'; | ||
import { loadTextFonts } from '../src/fonts/textfonts.js'; | ||
loadAllMusicFonts(); | ||
Flow.setMusicFont('Bravura', 'Gonville', 'Custom'); | ||
loadTextFonts(); | ||
export * from '../src/index.js'; | ||
export * as default from '../src/index.js'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"type": "module" | ||
} |