draw.SimpleText problem

Hello,

I decided not to post this in the “Help & Support” forum because this isn’t a problem “playing” Garry’s Mod but rather a problem with myself. Anyway, getting to the point, draw.SimpleText seems to be “warping” if to say. I don’t know if this is a Garry’s Mod problem or rather a system problem with fonts. All I know is that my other computers don’t do this and its only happening to me. This happens on all servers. Any help is appericated.

Mind showing your code?



-- From ULX Forums, updated for TkTTT
inChat = inChat or false

hook.Add("StartChat", "UlxChatComplete", function()
  inChat = true
end)

hook.Add("FinishChat", "UlxChatComplete", function()
  inChat = false
end)

local a = CreateClientConVar("ulx_chatcomplete", "1", true, false)
ulxSuggestions = ulxSuggestions or {}

hook.Add("PostDrawHUD", "UlxChatComplete", function()
  if a:GetBool() and inChat then
    local b, c = chat.GetChatBoxPos()
    b = b + ScrW() * 0.037
    c = c + ScrH() / 4 + 5
    local d = "Tahoma"
    surface.SetFont(d)

    for e, f in ipairs(ulxSuggestions) do
      local g, h = surface.GetTextSize(f.ChatCommand)
      draw.SimpleTextOutlined(f.ChatCommand, d, b, c, Color(255, 255, 100, 255), _, _, 0.5, Color(0, 0, 0, 255))
      draw.SimpleTextOutlined(" " .. f.AutoComplete .. " ", d, b + g, c, Color(255, 255, 255, 255), _, _, 0.5, Color(0, 0, 0, 255))
      c = c + h
    end
  end
end)

if SERVER then
  util.AddNetworkString("ULibChatCompleteList")

  hook.Add("PlayerInitialSpawn", "SendULibChatComplete", function(i)
    local ULibsayCmds = table.Copy(ULib.sayCmds)

    for e, f in pairs(ULibsayCmds) do
      ULibsayCmds[e].fn = nil
    end

    net.Start("ULibChatCompleteList")
    net.WriteTable(ULibsayCmds)
    net.Send(i)
  end)
else
  ULibsayCmds = ULibsayCmds or {}

  net.Receive("ULibChatCompleteList", function()
    ULibsayCmds = net.ReadTable()
  end)
end

hook.Add("OnChatTab", "UlxChatComplete", function(j)
  if ulxSuggestions and #ulxSuggestions >= 1 then
    local k = ulxSuggestions[1]

    return k.ChatCommand .. " " .. k.AutoComplete
  end
end)

local l = CreateClientConVar("ulx_chatcomplete_limit", "4", true, false)

hook.Add("ChatTextChanged", "UlxChatComplete", function(j)
  ulxSuggestions = {}
  local m = string.sub(j, 1, (string.find(j, " ") or #j + 1) - 1)

  if #m >= 1 and (string.sub(m, 0, 1) ~= "!" or #m >= 2) then
    if m  == "!menu" then return end
    if m  == "!xgui" then return end
    local i = LocalPlayer()

    for n, o in pairs(ULibsayCmds) do
      if #ulxSuggestions >= l:GetInt() then break end
      if not ULib.ucl.query(i, o.access) then return end
      n = string.lower(n):Trim()

      if string.sub(n, 0, #m) == string.lower(m) then
        if n == m then
          local p = string.sub(o.__cmd, 1, (string.find(o.__cmd, " ") or #o.__cmd + 1) - 1)
          local q = string.sub(o.__cmd, #p + 2, #o.__cmd)
          local r = string.sub(j, #p + 3, #j)
          local s = concommand.AutoComplete(p, q .. " " .. r)

          if s and #s > 0 then
            for e, f in pairs(s) do
              local k = {}
              k.ChatCommand = n
              k.AutoComplete = string.sub(f, #o.__cmd + 2, #f):Trim()
              table.insert(ulxSuggestions, k)
            end

            return
          end
        end

        local k = {}
        k.ChatCommand = n
        k.AutoComplete = ""
        table.insert(ulxSuggestions, k)
      end
    end

    table.SortByMember(ulxSuggestions, "ChatCommand", function(t, u) return t < u end)
  end
end)

try ceil/flooring b and c.

Didn’t work, thanks for help though.

bump

I ran into this same issue when trying to draw text in PostDrawHUD a few months back, actually. Being constrained to time in regards to what I was working on, I didn’t have time to look into it any further, so I have no idea what causes it, but it might be worth moving to HUDPaint. Same deal with DrawOverlay.

That seemed to fix it. IDK, maybe its a bug with an update awhile ago.