Label.mm 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. Copyright (C) 2009-2011 id Software LLC, a ZeniMax Media company.
  3. This program is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU General Public License
  5. as published by the Free Software Foundation; either version 2
  6. of the License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  14. */
  15. #import <Foundation/Foundation.h>
  16. #import <UIKit/UIKit.h>
  17. #import "Label.h"
  18. #include "Localization.h"
  19. @implementation idLabel
  20. /*
  21. ========================
  22. awakeFromNib
  23. ========================
  24. */
  25. - (void)awakeFromNib {
  26. [ self SetupLabel:@"idGinza Narrow" ];
  27. }
  28. /*
  29. ========================
  30. SetupLabel
  31. ========================
  32. */
  33. - (void) SetupLabel: ( NSString * )fontName {
  34. // Set the Font
  35. CGFloat points = self.font.pointSize;
  36. self.font = [UIFont fontWithName:fontName size:points];
  37. // Localize the text.
  38. NSString * unLocText = self.text;
  39. const char * utf8string = idLocalization_GetString( [unLocText UTF8String ] );
  40. self.text = [ NSString stringWithCString: utf8string encoding:NSUTF8StringEncoding ];
  41. }
  42. @end