@react-native-vector-icons/icomoon
Version:
Icomoon font for react native vector icons
36 lines (32 loc) • 1.06 kB
JavaScript
;
/**
* Fontello icon set component.
* Usage: <Fontello name="icon-name" size={20} color="#4F8EF7" />
*/
import { createIconSet } from '@react-native-vector-icons/common';
// entries are optional because they can be derived from the config
export default function createIconSetFromIcoMoon(config, postScriptNameOrOptions, fontFileNameParam) {
const {
postScriptName,
fontFileName,
fontSource,
fontStyle
} = typeof postScriptNameOrOptions === 'object' ? postScriptNameOrOptions : {
postScriptName: postScriptNameOrOptions,
fontFileName: fontFileNameParam
};
const glyphMap = {};
config.icons.forEach(icon => {
icon.properties.name.split(/\s*,\s*/g).forEach(name => {
glyphMap[name] = icon.properties.code;
});
});
const fontFamily = postScriptName || config.preferences.fontPref.metadata.fontFamily;
return createIconSet(glyphMap, {
postScriptName: fontFamily,
fontFileName: fontFileName || `${fontFamily}.ttf`,
fontSource,
fontStyle
});
}
//# sourceMappingURL=index.js.map