• 0

    posted a message on font shadows
    Ah, beautiful. Thank you.
    Posted in: Lua Code Discussion
  • 0

    posted a message on font shadows
    Don't know what to tell you. It's not coming from the addon itself. I may be fairly new to LUA, but I'm a pro with [Ctrl+F].
    Posted in: Lua Code Discussion
  • 0

    posted a message on font shadows
    CreateFontString does not exist in the addon code.
    Posted in: Lua Code Discussion
  • 0

    posted a message on font shadows
    Thanks, inthedrops. That was a thorough explanation. I've actually been looking around in Blizzard's XML files for a while now, and actually created my own addon that allows me to freely change font face, size, and style of every major Blizzard default font, so I did in fact already know how Blizzard created its font shadows.

    The issue is that I can't see anywhere in the addons I'm using where the addon itself calls a specific Blizzard font to use as its template. As an example, here's Skada's code for assigning fonts, broken down to just the relevant parts:

    function mod:ApplySettings(win)
    	local g = win.bargroup
    	local p = win.db
    	g:SetFont(media:Fetch('font', p.barfont), p.barfontsize,"OUTLINE")
    end


    Then later, the GUI config menu uses a dropdown to select the font, and slider for the font size. Nowhere is it mentioned what the font object should be, though. If that were the case, we should be able to find something like this in the code:

    g:SetFontObject("GameFontWhite")


    Nothing like that ever shows up, though. So, my assumption is that the addon defaults to some sort of font object if one isn't manually defined. My question is where that default font object is defined. From the feedback this post is getting so far, it sounds like Blizzard defines this, not Ace. I want confirmation on that, though, and I'd ideally also like the name of the default font object that is being used.

    Now, you might say, why not just toss in the SetFontObject line into the addons like I have posted above? The answer for that is, "local g" as defined in the code above seems to be a widget that doesn't support the SetFontObject method. Any time I try to add the line, I end up getting an error message reading:

    "attempt to call method 'SetFontObject' (a nil value)."

    I'm sure there's a way around this, but I'm far too novice in LUA to be able to figure it out (hours of trying and failing is testament to that).

    To answer your question, inthedrops: this is happening on a few different addons, but the two I'm primary concerned with are the two I have screenshots of above: Shadowed Unit Frames, and Skada Damage Meters.
    Posted in: Lua Code Discussion
  • 0

    posted a message on font shadows
    I'm sorry, but no, that's not the point. There is NOTHING in the addon code that declares shadows to be added, or picks a game font that uses a shadow by default. So, it has to be coming from somewhere else. It was already stated above that only certain selected fonts already come with a drop shadow. I've looked through Blizzard's XML files, and could even provide you with a specific list of the fonts that come with drop shadows.

    All that to say, no one has definitively answered my question yet: where is the shadow coming from? When an addon uses SetFont, but does not select one of the game's default fonts (e.g. "GameFontNormal") to edit, is WoW auto-assigning a default game font that already contains a shadow?
    Posted in: Lua Code Discussion
  • 0

    posted a message on font shadows
    Here are three screenshots illustrating what I mean:

    Image one is of Shadowed Unit Frames, using a thin outline.



    Image two is of the same line, but with the outline turned off. Note that the drop shadow still exists.



    Image three of Skada's damage meters. The text reading "DPS" has an outline but no drop shadow, while the text below has both an outline and a drop shadow.



    Again, in none of these addons can I actually find anywhere that adds a drop shadow to the fonts used. I'd understand if the addon was using a system font instance like GameFontNormal, but I see no reference to any system-defined font, either.
    Posted in: Lua Code Discussion
  • 0

    posted a message on font shadows
    Quote from yssaril
    it is up to the addon authors to add config for this (has nothing to do with Ace itself)


    Why am I getting drop shadows without the individual addons declaring it, then? None of the addons themselves show any code to indicate the addition of drop shadows.
    Posted in: Lua Code Discussion
  • 0

    posted a message on font shadows
    Apologies for how generic this question is.

    I often find that addons using Ace (like Skada and Shadowed Unit Frames, for example) end up using fonts that have a drop shadow that cannot be turned off, even though there is no mention in the addon itself of adding a shadow to the chosen font.

    Is this something in the Ace code? Can it be changed? I'd prefer to not use a drop shadow by default.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Help with first addon
    Figured it out!

    function MyAddon:SetFont(Object, Font, Size, Style)
         NewObject = _G[Object]
         NewObject:SetFont(Font, Size, Style)
    end
    Posted in: Lua Code Discussion
  • 0

    posted a message on Help with first addon
    Thanks for the help. I'm new to posting code on forums; I'll start using the tags.

    I'm creating FontGroup from a dropdown selection in the GUI table. Here's the pertinent code, along with getter and setter:

    FontGroup = {
    	name   = "Font or Font Group",
    	type   = "select",
    	values = {
    		["SystemFont_Tiny"] = "SystemFont_Tiny",
    		["SystemFont_Small"] = "SystemFont_Small",
    	},
    	get	= function(Infotable)
    		return self.db.profile[Infotable[#Infotable]]
    		end,
    	set	= (Infotable, Value)
    		self.db.profile[Infotable[#Infotable]] = Value
    		end,


    I also have a button that executes a simple print function of the value I gathered from the above code:

    func   = function ()
    	print(self.db.profile.FontGroup);
    	end,


    This seems to work just fine, i.e. if I select SystemFont_Med1 from my dropdown, my button function will print the text SystemFont_Med1 in my chat window. So, if self.db.profile.FontGroup is the problem, the problem doesn't seem to extend to the printing function.

    I read on another post (actually it was a bug ticket for Ace3 from back in May of 2010) that GetFont and SetFont will not work if the font's Object is a string. I assume it's a string in my code, since all the other variables I've created return strings. If this is the problem, how do I avoid making the font Object a string, and what should it be instead?
    Posted in: Lua Code Discussion
  • 0

    posted a message on Help with first addon
    Sorry, what are you asking for?

    The line causing the error is the line that reads "Object:SetFont(Font, Size, Style). It only causes an error when I try to use my variable "FontGroup" for the line "self:SetFont(FontGroup,FontFace,FontSize,FontOutline)", though. If I replace the FontGroup variable with a specific value, such as the font name SystemFont_Med1, it works just fine.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Help with first addon
    I've been in the process of creating my first addon. It's similar to Fontifier or Fonter, which can be found on Curse, except that it will allow the user to edit every font in the game one by one, rather than breaking all fonts into a few groups and editing a whole group at once. Through doing this, I'm giving myself (and anyone else who wants to use my addon) the luxury of much more specific control over how my UI looks, at the tradeoff of more time "behind the wheel" fiddling with specific font instances in-game. This works for me, though, as I am an obsessed UI creator who spends more time creating new UIs than I do actually playing the game.

    I'm very nearly done with the addon, but I'm running into two issues, and would love some help:

    First, the way Fontifier etc. accomplish their goals is by taking a whole group of font instances and assigning them all the same font at once. As a brief example, SystemFont_Med1, SystemFont_Med3, SystemFont_Small, etc. will all be called "Normal Fonts" or something like that, and when the user picks the font they want from the proper dropdown, SystemFont_Med1, SystemFont_Med3, and SystemFont_Small will all receive the same font face at once. The code looks something like this:

    function Fontifier:SetFont(Object, Font, Size, Style)
    Object:SetFont(Font, Size, Style)
    end

    function Fontifier:SetCurrentFont()
    local Font = LSM:Fetch("font", self.db.profile.FontFace)
    local Size = self.db.profile.FontSize
    local Outline = self.db.profile.FontOutline

    self:SetFont (SystemFont_Med1, Font , Size, Outline)
    self:SetFont (SystemFont_Med3, fontMed , size , style)
    self:SetFont (SystemFont_Small, fontMed , size , style)
    etc.

    What I'm trying to do instead is make the font instance its own variable by defining it in a separate dropdown. Then, instead of defining multiple "SetFont" lines at once, mine boils down to a single line, which looks like:

    function MyAddon:SetFont(Object, Font, Size, Style)
    Object:SetFont(Font, Size, Style)
    end

    function MyAddon:SetCurrentFont()
    local FontFace = LSM:Fetch("font", self.db.profile.FontFace)
    local FontSize = self.db.profile.FontSize
    local FontOutline = self.db.profile.FontOutline
    local FontGroup = self.db.profile.FontGroup

    self:SetFont (FontGroup, FontFace, FontSize, FontOutline)

    So mine only edits one font instance at a time, and pulls in a variable via dropdown to define specifically which font instance will be edited.

    The problem I'm running into is that I'm getting an error message saying I'm "attempt to index local 'Object' (a nil value)". I assume this is because of the way I'm pulling in the variable here. I admit I know very little of proper LUA formatting (this is my first experience with it), but my guess is that when the value is pulled in for FontGroup, it's automatically putting quotation marks around the value, as most arguments for a function seem to be denoted this way.

    Fellow scripters: does this make sense? If that is indeed what's happening, is there a way to pull in the value I need without the quotation marks so my function can be properly recognized? Or, of this isn't the problem, can you tell me what is the issue, and how I can fix it? Thank you for reading through this long post, and thanks in advance for the advice!


    Second question, much faster: when looking at the XML file for fonts, I can see that there are tags on some fonts that create a drop shadow for that font by creating a shadow and setting the X,Y offset to 1,-1. Is there an easy way to add a drop shadow to a font that doesn't already have one? Or am I sadly right in assuming that even if it is possible, it would be a hell of a lot of work, because the drop shadow is assigned to the Frame, and not the Font itself, so I can't define the drop shadow just by editing the Font?

    Note: I'm looking specifically for creation of a drop shadow here, not just an outline - I already know how to give a font an outline. Thanks again!
    Posted in: Lua Code Discussion
  • To post a comment, please or register a new account.