[RMVX ACE] IS IT POSSIBLE TO STOP ACE FROM RESIZING TEXT?

Posts

Pages: 1
unity
You're magical to me.
12188
When you put text in a field for the menu or in battle, VX Ace will shrink it if it thinks it won't fit in the box. But I'm using a custom font and VX Ace is resizing things even when there's plenty of room.

Is there a script or a way to stop Ace from resizing things at all? That would be a huge help, if it's at all possible.

Thanks a ton! ^_^
Vaccaria
Programmer thinks it's a good idea to make a game in a low-level language.
4859
Find some custom message scripts like Yanfly's or any other scripters to date. However, if you want the more basic solution, you should try this... (but I don't know if it works, though 'cuz I just searched it through the internet.)

Font.default_name = "XXX"
Font.default_size = 16
Font.default_shadow = false
Font.default_bold = false
Font.default_italic = false
Font.default_outline = false
You can hijack the draw_text function and change the target width parameter. Here's a quick hack I threw together, it'll try to use way more space than it'll ever have when drawing left aligned text. Changing center/right aligned text wouldn't work with this quick hack (it uses the space to place the text and if it has a million pixels offscreen it'll try to draw it there instead):
class Bitmap
  
  alias :draw_text_noresize :draw_text unless $@
  def draw_text(*args) 
    # Since this is an overloaded method and alias doesn't work pretty with them
    # we need to see which method is being called and act appropriately
    case args.length
      when 2..3
        # Determine the alignment parameter, we may not get it from the args
        align = args.length == 2 ? 0 : args[2]
        # We got a rect
        rect = Rect.new
        rect.set(args[0])
        # Only change the width to be infinite for left-aligned text
        rect.width = 9999 if align == 0
        # Draw the text using our new paremters
        return draw_text_noresize(rect, args[1], align)
      when 5..6
        # Determine the alignment parameter, we may not get it from the args
        align = args.length == 5 ? 0 : args[5]
        # It's the expanded parameters so just replace the width one
        return draw_text_noresize(
          args[0], 
          args[1], 
          # Only use max width for left aligned text
          align == 0 ? 9999 : args[2],
          args[3],
          args[4],
          align)
      else
        # Something went wrong so let the caller deal with it
        print "Invalid length: #{args.length}\n"
        draw_text_noresize(*args)
    end
  end
  
end
unity
You're magical to me.
12188
Thanks so much, GRS! :DDDD This is wonderful!

This fixes all the resizing instances except one, on the character's Level.



Being at Levels 1 thru 9, things display fine. But at Level 10, the text still goes small. I'm guessing that's because its center-aligned. If there's not an easy way to fix it, I think I can live with it, but if you have any ideas, please let me know.

Thanks again ^_^
Rhyme
Tear Harvester Rhyme
7172
  #--------------------------------------------------------------------------

# * Draw Level
#--------------------------------------------------------------------------
def draw_actor_level(actor, x, y)
change_color(system_color)
draw_text(x, y, 72, line_height, Vocab::level_a)
change_color(normal_color)
draw_text(x + 32, y, 24, line_height, actor.level, 2)
end

In particular, the line
draw_text(x, y, 72, line_height, Vocab::level_a)
That number determines the "draw width" of the text! If it squishes again on stuff like Level 100, you can raise it even further to make it fit more.
Do note that it can potentially over-draw to the HP gauges if the width is set too large.
unity
You're magical to me.
12188
Hmm, I couldn't get it to work. Maybe it's because I'm using Yanfly's Core Engine and Menu Engine.
Welp, guess being lazy doesn't cut it! I'll update the script tonight to handle center aligned text.
unity
You're magical to me.
12188
author=GreatRedSpirit
Welp, guess being lazy doesn't cut it! I'll update the script tonight to handle center aligned text.

;_; Thanks for your hard work! I really appreciate it! ^_^
(Next time I'll try to find a font that isn't so troublesome XD;;;;)
InfectionFiles
the world ends in whatever my makerscore currently is
4370
Oh, this is wonderful!
Try this, I eyeballed half of it. Give me shit if it still doesn't work:

class Bitmap
  
  alias :draw_text_noresize :draw_text unless $@
  def draw_text(*args) 
    # Since this is an overloaded method and alias doesn't work pretty with them
    # we need to see which method is being called and act appropriately
    case args.length
      when 2..3
        # Determine the alignment parameter, we may not get it from the args
        align = args.length == 2 ? 0 : args[2]
        # We got a rect, pull the parameters from it
        x = args[0].x
        y = args[0].y
        width = args[0].width
        height = args[0].height
        str = args[1]
      when 5..6
        # Determine the alignment parameter, we may not get it from the args
        align = args.length == 5 ? 0 : args[5]
        # It's the expanded parameters so just replace the width one
        x = args[0]
        y = args[1]
        width = args[2]
        height = args[3]
        str = args[4]
      else
        # Something went wrong so let the caller deal with it
        print "Invalid length: #{args.length}\n"
        return draw_text_noresize(*args)
    end
    
    # Now that we have our arguments we can do our adjustments
    # They are based on the text alignment, simply adding more width will only
    # work when the text is left aligned. Otherwise we'll have to adjust the x
    # position too
    case align
      when 0 # Left aligned
        # We can just make the width super huge
        width = 9999
      when 1 # Center aligned
        # We have to move the x position back back
        x -= 9999 / 2
        width += 9999
      when 2 # Right aligned
        # We have to move the x position all the way back to ensure the right
        # boundary of the draw text is in the same position
        x -= 9999
        width += 9999
    end
    # Now that we have our final parameters call the draw_text function  
    draw_text_noresize(x, y, width, height, str, align)
  end
  
end
unity
You're magical to me.
12188
IT WORKS! :DDDDDDDDDDDDDDD

Thank you so so so so much, GRS! ^_____^ You once again totally saved the day!!!
Glad to hear it works :) Good luck with your latest game!
unity
You're magical to me.
12188
:DDDDDDDDDDDDDDDDDD Thanks again!
Just a heads up: It doesn't fix the font drawing issue directly, it just gives more space to draw the text than the game will ever need. This does mean that it'll keep drawing text outside of horizontal boundaries the game gives in the same bitmap. This means that long names or strings can run into other text, but generally only in the same window. For example if Luka's name was "Weedlord TurboNerd Luka" it'll draw the full name and it'd run into the "Paladin" text. It usually won't be a problem, just watch out for item/skill names.

e: At the same time if "Items" was "Use this totally kickin' rad item" it's still confined to its bitmap so it woudln't spill into the party status window or anything. /e:

(Technically a script can avoid this but it'd requires drawing to another bitmap then transferring the rendered text to the real target bitmap where the text would be seen. It'd just lead to text cutoff instead though so IMO there's no reason to do the extra work and performance hit of a bitmap.blt call for something that's still a bug (strings too long))
unity
You're magical to me.
12188
Right! I'm already making sure to keep names, skills, items, weapons, armor etc somewhat short to keep that problem from happening ^_^ Names that didn't run out of room but still caused the text to shrink were driving me crazy. XD
Pages: 1