Quantcast
Download
(4 Kb)
Download
Updated: 02/23/15 08:41 PM
Compatibility:
Update 6 (1.6.5)
Updated:02/23/15 08:41 PM
Created:03/13/14 10:38 PM
Monthly downloads:109
Total downloads:4,848
Favorites:23
MD5:
LibMediaProvider
Version: 1.0 r8
by: Garkin, Seerah
Garkin has offered to take over LibMediaProvider.

LibMediaProvider is inspired by and borrows from LibSharedMedia-3.0, written for World of Warcraft.

This library facilitates the sharing of media (fonts, textures, etc) between addons. An addon can register media with LibMediaProvider, which then turns around and provides that media to any addon requesting media of that type.

Things To Know:
  • The "None" option for borders/backgrounds was removed, as ESO displays a white default texture if no file path is provided. Addons should handle hiding borders/backgrounds on their own through the alpha channel.
  • ESO currently does not support addon custom sounds to the game. Some sounds from the default UI have been provided as choices for your addons to use.
  • Label:SetFont("font") may be used with more than just a pre-defined font from the default UI. It may also take a string that is a combination of a file path, font size, and font style.
    Ex: label:SetFont("MyAddon/Font/path.ttf|18|soft-shadow-thin")
  • There is currently only one statusbar texture in the game. If you wish to have access to more, they must be provided and registered by an addon.
  • Currently supported media types: background, border, font, statusbar, sound


API Documentation:

:Register(mediatype, key, data)
Registers a new handle of given type.
Arguments
mediatype
string - the type of the data, eg. font or statusbar
key
string - the handle to get the data from the lib
data
string - the data to associate with the handle; normaly a filename
Returns
boolean - false if data for the given mediatype-key pair already existes, true else
:Fetch(mediatype, key)
Fetches the data for the given handle and type.
Arguments
mediatype
string - the type of the data, eg. font or statusbar
key
string - the handle to get the data from the lib
Returns
string or nil - the data for the given handle or nil
:IsValid(mediatype [, key])
Checks if the given type (and handle) is valid.
Arguments
mediatype
string - the type of the data, eg. font or statusbar
[key]
string - the handle of the data
Returns
boolean - true if the type (and handle) is valid
:HashTable(mediatype)
Gets a hash table {data -> handle} to eg. iterate over.
Arguments
mediatype
string - the type of the data, eg. font or statusbar
Returns
table - hash table for the given type
:List(mediatype)
Gets a sorted list of handles.
Arguments
mediatype
string - the type of the data, eg. font or statusbar
Returns
table - list of handles for the given type
:GetDefault(mediatype)
Returns the default return value for nonexistant handles.
Arguments
mediatype
string - the type of the data, eg. font or statusbar
Returns
string or nil - default return value for nonexistant handles for the given type
:SetDefault(type, handle)
Sets a default return value for nonexistant handles. Won't replace an already set default.
Arguments
type
string - the type of the data, eg. font or statusbar
handle
string - the handle of the data
Returns
none

Callback:

LibMediaProvider_Registered
fires when a new handle was successfully registered
Argumentss
name
"LibSharedMedia_Registered"
mediatype
the type of the new handle
key
the name of the handle

Predefined Data:
Media from the default UI of the 5 main types is already pre-registered with the library.
1.0 r8
- updated API Version number to 100011
- updated fonts for patch 1.6

1.0 r7
- updated API Version number to 100010
- removed fonts that are no longer contained in the game files (they have been added to the MediaStash addon, however)
- changed default font from Arial Narrow (removed) to Univers 55

1.0 r6
- preserve externally registered media types through library upgrades

1.0 r5
- preserve externally registered media through library upgrades

1.0 r4
- changed file path for solid textures to "" (since ESO treats an empty path as a solid color)
- updated LibStub.lua

1.0 r3
- fixed bug where default handle was not returned if handle provided in :Fetch() was not found

1.0 r2
- changed the default for backgrounds and borders since I removed the "none" option
Archived Files (7)
File Name
Version
Size
Author
Date
1.0 r7
4kB
Garkin
11/06/14 11:13 PM
1.0 r6
4kB
Seerah
07/20/14 08:02 PM
1.0 r5
4kB
Seerah
07/17/14 08:49 PM
1.0 r4
4kB
Seerah
07/13/14 09:26 PM
1.0 r3
4kB
Seerah
03/15/14 01:29 PM
1.0 r2
4kB
Seerah
03/14/14 07:26 PM
1.0 r1
4kB
Seerah
03/13/14 10:38 PM


Post A Reply Comment Options
Unread 02/06/17, 02:48 PM  
Imiona
 
Imiona's Avatar

Forum posts: 1
File comments: 27
Uploads: 0
Is it possible to register my own custom Fonts with this, and if so, how do i get Addons to use it?

Thx
Report comment to moderator  
Reply With Quote
Unread 02/23/15, 08:54 PM  
Garkin
 
Garkin's Avatar
AddOn Author - Click to view AddOns

Forum posts: 853
File comments: 1123
Uploads: 33
LibMediaProvider-1.0 r8

Even if patch 1.6 is not on live server yet, I have updated this library in advance. Actually there was just one small change - all Futura fonts were replaced with different font files which includes previously unsupported special characters (for example ). As those new font files doesn't exist in 1.5 game files, I do not recommend using r8 with patch 1.5.
__________________
@Garkin (retired from ESO)
My addons: SkyShards, LoreBooks, Dustman, Map Coordinates, No, thank you!, ... (full list)
Report comment to moderator  
Reply With Quote
Unread 08/23/14, 10:11 PM  
skyraker
AddOn Author - Click to view AddOns

Forum posts: 154
File comments: 129
Uploads: 4
Originally Posted by Garkin
Only reason I can imagine is that you use old version of LMP and register font before library is updated. There was an issue where all registered media files were removed when library was updated.
To avoid this issue update LMP to the latest version and/or make sure that you do not register media types before library is fully updated. It means from EVENT_ADD_ON_LOADED handler or later.
Can't believe I hadn't updated it. Thanks!
Report comment to moderator  
Reply With Quote
Unread 08/17/14, 09:27 AM  
Garkin
 
Garkin's Avatar
AddOn Author - Click to view AddOns

Forum posts: 853
File comments: 1123
Uploads: 33
Originally Posted by skyraker
Would there be any reason why LMP (or the game) would stop displaying a monospaced font properly? When I first added the font to my addon, it was displaying properly monospaced. But I do not know if a game update changed that or if it something with how LMP interacts with the UI.
Only reason I can imagine is that you use old version of LMP and register font before library is updated. There was an issue where all registered media files were removed when library was updated.
To avoid this issue update LMP to the latest version and/or make sure that you do not register media types before library is fully updated. It means from EVENT_ADD_ON_LOADED handler or later.
__________________
@Garkin (retired from ESO)
My addons: SkyShards, LoreBooks, Dustman, Map Coordinates, No, thank you!, ... (full list)
Report comment to moderator  
Reply With Quote
Unread 08/17/14, 08:33 AM  
skyraker
AddOn Author - Click to view AddOns

Forum posts: 154
File comments: 129
Uploads: 4
Would there be any reason why LMP (or the game) would stop displaying a monospaced font properly? When I first added the font to my addon, it was displaying properly monospaced. But I do not know if a game update changed that or if it something with how LMP interacts with the UI.
Report comment to moderator  
Reply With Quote
Unread 06/03/14, 11:48 AM  
Kraeius
 
Kraeius's Avatar
AddOn Author - Click to view AddOns

Forum posts: 25
File comments: 247
Uploads: 3
Originally Posted by Seerah
Okay, so LibMediaProvider is just a library that uses LibStub. It is quite possible that the copy of the library you are editing is not even the copy of the library being loaded into memory.

You shouldn't edit the library itself. You need to use the API to register a font. That, or use LMP MediaStash.

/edit: Sorry I didn't get that right away...
OK I get it now, thank you for your time
Report comment to moderator  
Reply With Quote
Unread 06/03/14, 11:39 AM  
Seerah
Fishing Trainer
 
Seerah's Avatar
ESOUI Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 651
File comments: 112
Uploads: 1
Okay, so LibMediaProvider is just a library that uses LibStub. It is quite possible that the copy of the library you are editing is not even the copy of the library being loaded into memory.

You shouldn't edit the library itself. You need to use the API to register a font. That, or use LMP MediaStash.

/edit: Sorry I didn't get that right away...
Last edited by Seerah : 06/03/14 at 11:40 AM.
Report comment to moderator  
Reply With Quote
Unread 06/03/14, 04:34 AM  
Kraeius
 
Kraeius's Avatar
AddOn Author - Click to view AddOns

Forum posts: 25
File comments: 247
Uploads: 3
Originally Posted by Seerah
Originally Posted by Kraeius
Which space on which file name?

Here is what I tried to do;
Oh, oops - I was thinking the file name, not the display name you gave it in LMP. ><

Now that I reread your initial comment, I notice that you said on one line that you can't see the font in the settings menu, yet on the next line you said that you can. Could you please clarify this?
OK, I'll try to write more clear.

My test addon uses LibMediaProvider for fonts and it calls LMP's font table, so in settings menu I can see and select all of the fonts on my LibMediaLibrary-1.0 file.

Now my aim is to add an external font to the LibMediaLibrary-1.0 file so I can call it with others and use.

Original LMP's font codes are like this;

Code:
-- FONT
LMP.MediaTable.font = {}
LMP.MediaTable.font["ProseAntique"]         = "EsoUI/Common/Fonts/ProseAntiquePSMT.otf"
LMP.MediaTable.font["Arial Narrow"]             = "EsoUI/Common/Fonts/arialn.ttf"
LMP.MediaTable.font["Consolas"]             = "EsoUI/Common/Fonts/consola.ttf"
LMP.MediaTable.font["ESO Cartographer"]         = "EsoUI/Common/Fonts/esocartographer-bold.otf"
LMP.MediaTable.font["Fontin Bold"]              = "EsoUI/Common/Fonts/fontin_sans_b.otf"
LMP.MediaTable.font["Fontin Italic"]                    = "EsoUI/Common/Fonts/fontin_sans_i.otf"
LMP.MediaTable.font["Fontin Regular"]           = "EsoUI/Common/Fonts/fontin_sans_r.otf"
LMP.MediaTable.font["Fontin SmallCaps"]         = "EsoUI/Common/Fonts/fontin_sans_sc.otf"
LMP.MediaTable.font["Skyrim Handwritten"]       = "EsoUI/Common/Fonts/Handwritten_Bold.otf"
LMP.MediaTable.font["Trajan Pro"]               = "EsoUI/Common/Fonts/trajanpro-regular.otf"
LMP.MediaTable.font["Univers 55"]               = "EsoUI/Common/Fonts/univers55.otf"
LMP.MediaTable.font["Univers 57"]               = "EsoUI/Common/Fonts/univers57.otf"
LMP.MediaTable.font["Univers 67"]               = "EsoUI/Common/Fonts/univers67.otf"
So I tried to add that new font as an external line of code to the end of the table;

Code:
-- FONT
LMP.MediaTable.font = {}
LMP.MediaTable.font["ProseAntique"]         = "EsoUI/Common/Fonts/ProseAntiquePSMT.otf"
LMP.MediaTable.font["Arial Narrow"]             = "EsoUI/Common/Fonts/arialn.ttf"
LMP.MediaTable.font["Consolas"]             = "EsoUI/Common/Fonts/consola.ttf"
LMP.MediaTable.font["ESO Cartographer"]         = "EsoUI/Common/Fonts/esocartographer-bold.otf"
LMP.MediaTable.font["Fontin Bold"]              = "EsoUI/Common/Fonts/fontin_sans_b.otf"
LMP.MediaTable.font["Fontin Italic"]                    = "EsoUI/Common/Fonts/fontin_sans_i.otf"
LMP.MediaTable.font["Fontin Regular"]           = "EsoUI/Common/Fonts/fontin_sans_r.otf"
LMP.MediaTable.font["Fontin SmallCaps"]         = "EsoUI/Common/Fonts/fontin_sans_sc.otf"
LMP.MediaTable.font["Skyrim Handwritten"]       = "EsoUI/Common/Fonts/Handwritten_Bold.otf"
LMP.MediaTable.font["Trajan Pro"]               = "EsoUI/Common/Fonts/trajanpro-regular.otf"
LMP.MediaTable.font["Univers 55"]               = "EsoUI/Common/Fonts/univers55.otf"
LMP.MediaTable.font["Univers 57"]               = "EsoUI/Common/Fonts/univers57.otf"
LMP.MediaTable.font["Univers 67"]               = "EsoUI/Common/Fonts/univers67.otf"
LMP.MediaTable.font["New Font Name"]               = "AddonName/Fonts/fontName.ttf"
After editing original LMP, I still see the default fonts on the test addon's settings. This "New Font Name" is not there.

---

Also on second line I meant, even if I change one of the names of default fonts in the LMP, like ("Trajan Pro" to "Trajan ProX15", and check the addon's settings, I can't see that change and font's name is still "Trajan Pro".

---

Basically, I cant see the change I made on the LMP when I open my test addon's settings menu. It's always same fonts there with same non-modified names. So, I can't edit LMP as I see.
Report comment to moderator  
Reply With Quote
Unread 06/02/14, 06:28 PM  
Seerah
Fishing Trainer
 
Seerah's Avatar
ESOUI Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 651
File comments: 112
Uploads: 1
Originally Posted by Kraeius
Which space on which file name?

Here is what I tried to do;
Oh, oops - I was thinking the file name, not the display name you gave it in LMP. ><

Now that I reread your initial comment, I notice that you said on one line that you can't see the font in the settings menu, yet on the next line you said that you can. Could you please clarify this?
Report comment to moderator  
Reply With Quote
Unread 06/01/14, 11:55 PM  
Kraeius
 
Kraeius's Avatar
AddOn Author - Click to view AddOns

Forum posts: 25
File comments: 247
Uploads: 3
Originally Posted by Seerah
Originally Posted by Kraeius
Hey Seerah,

I'm using LibMediaProvider to test something and having a problem that I want to consult with you.

I've added a new external font to the font table inside the LMP but still I can't see it on the settings menu of the testing addon.

Even if I change "Univers 57"s name to "Univers 577", I still see it as 57 on the settings menu somehow. I've tried reloading UI, deleting old saved variables etc.

Whats your suggestion?
Did you try removing the space from the file name?
Which space on which file name?

Here is what I tried to do;

Lua Code:
  1. -- FONT
  2. LMP.MediaTable.font = {}
  3. LMP.MediaTable.font["ProseAntique"]         = "EsoUI/Common/Fonts/ProseAntiquePSMT.otf"
  4. LMP.MediaTable.font["Arial Narrow"]             = "EsoUI/Common/Fonts/arialn.ttf"
  5. LMP.MediaTable.font["Consolas"]             = "EsoUI/Common/Fonts/consola.ttf"
  6. LMP.MediaTable.font["ESO Cartographer"]         = "EsoUI/Common/Fonts/esocartographer-bold.otf"
  7. LMP.MediaTable.font["Fontin Bold"]              = "EsoUI/Common/Fonts/fontin_sans_b.otf"
  8. LMP.MediaTable.font["Fontin Italic"]                    = "EsoUI/Common/Fonts/fontin_sans_i.otf"
  9. LMP.MediaTable.font["Fontin Regular"]           = "EsoUI/Common/Fonts/fontin_sans_r.otf"
  10. LMP.MediaTable.font["Fontin SmallCaps"]         = "EsoUI/Common/Fonts/fontin_sans_sc.otf"
  11. LMP.MediaTable.font["Skyrim Handwritten"]       = "EsoUI/Common/Fonts/Handwritten_Bold.otf"
  12. LMP.MediaTable.font["Trajan Pro"]               = "EsoUI/Common/Fonts/trajanpro-regular.otf"
  13. LMP.MediaTable.font["Univers 55"]               = "EsoUI/Common/Fonts/univers55.otf"
  14. LMP.MediaTable.font["Univers 57"]               = "EsoUI/Common/Fonts/univers57.otf"
  15. LMP.MediaTable.font["Univers 67"]               = "EsoUI/Common/Fonts/univers67.otf"
  16. LMP.MediaTable.font["New Font"]             = "NewFontPath/NewFontPath/NewFontPath/newfont.ttf"
  17. LMP.DefaultMedia.font = "Arial Narrow"
Report comment to moderator  
Reply With Quote
Unread 06/01/14, 05:48 PM  
Seerah
Fishing Trainer
 
Seerah's Avatar
ESOUI Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 651
File comments: 112
Uploads: 1
Originally Posted by Kraeius
Hey Seerah,

I'm using LibMediaProvider to test something and having a problem that I want to consult with you.

I've added a new external font to the font table inside the LMP but still I can't see it on the settings menu of the testing addon.

Even if I change "Univers 57"s name to "Univers 577", I still see it as 57 on the settings menu somehow. I've tried reloading UI, deleting old saved variables etc.

Whats your suggestion?
Did you try removing the space from the file name?
Report comment to moderator  
Reply With Quote
Unread 06/01/14, 01:33 PM  
Kraeius
 
Kraeius's Avatar
AddOn Author - Click to view AddOns

Forum posts: 25
File comments: 247
Uploads: 3
Hey Seerah,

I'm using LibMediaProvider to test something and having a problem that I want to consult with you.

I've added a new external font to the font table inside the LMP but still I can't see it on the settings menu of the testing addon.

Even if I change "Univers 57"s name to "Univers 577", I still see it as 57 on the settings menu somehow. I've tried reloading UI, deleting old saved variables etc.

Whats your suggestion?
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: