Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions code/__DEFINES/fonts.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//FONTS: Used by Paper, PhotoCopier, PDA's Notekeeper, NewsCaster, NewsPaper, ModularComputers (and PaperBin once a year).
/// Font used by regular pens
#define PEN_FONT "Verdana"
/// Font used by fancy pens
#define FOUNTAIN_PEN_FONT "Segoe Script"
/// Font used by crayons
#define CRAYON_FONT "Comic Sans MS"
/// Font used by printers
#define PRINTER_FONT "Times New Roman"
/// Font used when a player signs their name
#define SIGNFONT "Times New Roman"
/// Font used by charcoal pens
#define CHARCOAL_FONT "Candara"

//pda fonts
#define MONO "Monospaced"
#define VT "VT323"
#define ORBITRON "Orbitron"
#define SHARE "Share Tech Mono"

GLOBAL_LIST_INIT(pda_styles, sortList(list(MONO, VT, ORBITRON, SHARE)))


// Font metrics bitfield
/// Include leading A width and trailing C width in GetWidth() or in DrawText()
#define INCLUDE_AC (1<<0)
20 changes: 0 additions & 20 deletions code/__DEFINES/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,6 @@ Will print: "/mob/living/carbon/human/death" (you can optionally embed it in a s
#define GAME_STATE_PLAYING 3
#define GAME_STATE_FINISHED 4

//FONTS:
// Used by Paper and PhotoCopier (and PaperBin once a year).
// Used by PDA's Notekeeper.
// Used by NewsCaster and NewsPaper.
// Used by Modular Computers
#define PEN_FONT "Verdana"
#define FOUNTAIN_PEN_FONT "Segoe Script"
#define CRAYON_FONT "Comic Sans MS"
#define PRINTER_FONT "Times New Roman"
#define SIGNFONT "Times New Roman"
#define CHARCOAL_FONT "Candara"

#define RESIZE_DEFAULT_SIZE 1

//transfer_ai() defines. Main proc in ai_core.dm
Expand Down Expand Up @@ -247,14 +235,6 @@ GLOBAL_LIST_INIT(ghost_accs_options, list(GHOST_ACCS_NONE, GHOST_ACCS_DIR, GHOST

GLOBAL_LIST_INIT(ghost_others_options, list(GHOST_OTHERS_SIMPLE, GHOST_OTHERS_DEFAULT_SPRITE, GHOST_OTHERS_THEIR_SETTING)) //Same as ghost_accs_options.

//pda fonts
#define MONO "Monospaced"
#define VT "VT323"
#define ORBITRON "Orbitron"
#define SHARE "Share Tech Mono"

GLOBAL_LIST_INIT(pda_styles, list(MONO, VT, ORBITRON, SHARE))

//pda icon reskins
#define PDA_SKIN_CLASSIC "Classic"

Expand Down
39 changes: 38 additions & 1 deletion code/__DEFINES/text.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,43 @@
/// Prepares a text to be used for maptext. Use this so it doesn't look hideous.
/// Standard maptext
/// /// Prepares a text to be used for maptext. Use this so it doesn't look hideous.
#define MAPTEXT(text) {"<span class='maptext'>[##text]</span>"}

/**
* Pixel-perfect scaled fonts for use in the MAP element as defined in skin.dmf
*
* Four sizes to choose from, use the sizes as mentioned below.
* Between the variations and a step there should be an option that fits your use case.
* BYOND uses pt sizing, different than px used in TGUI. Using px will make it look blurry due to poor antialiasing.
*
* Default sizes are prefilled in the macro for ease of use and a consistent visual look.
* To use a step other than the default in the macro, specify it in a span style.
* For example: MAPTEXT_PIXELLARI("<span style='font-size: 24pt'>Some large maptext here</span>")
*/
/// Large size (ie: context tooltips) - Size options: 12pt 24pt.
#define MAPTEXT_PIXELLARI(text) {"<span style='font-family: \"Pixellari\"; font-size: 12pt; -dm-text-outline: 1px black'>[##text]</span>"}

/// Standard size (ie: normal runechat) - Size options: 6pt 12pt 18pt.
#define MAPTEXT_GRAND9K(text) {"<span style='font-family: \"Grand9K Pixel\"; font-size: 6pt; -dm-text-outline: 1px black'>[##text]</span>"}

/// Small size. (ie: context subtooltips, spell delays) - Size options: 12pt 24pt.
#define MAPTEXT_TINY_UNICODE(text) {"<span style='font-family: \"TinyUnicode\"; font-size: 12pt; line-height: 0.75; -dm-text-outline: 1px black'>[##text]</span>"}

/// Smallest size. (ie: whisper runechat) - Size options: 6pt 12pt 18pt.
#define MAPTEXT_SPESSFONT(text) {"<span style='font-family: \"Spess Font\"; font-size: 6pt; line-height: 1.4; -dm-text-outline: 1px black'>[##text]</span>"}

/**
* Prepares a text to be used for maptext, using a variable size font.
*
* More flexible but doesn't scale pixel perfect to BYOND icon resolutions.
* (May be blurry.) Can use any size in pt or px.
*
* You MUST Specify the size when using the macro
* For example: MAPTEXT_VCR_OSD_MONO("<span style='font-size: 24pt'>Some large maptext here</span>")
*/
/// Prepares a text to be used for maptext, using a variable size font.
/// Variable size font. More flexible but doesn't scale pixel perfect to BYOND icon resolutions. (May be blurry.) Can use any size in pt or px.
#define MAPTEXT_VCR_OSD_MONO(text) {"<span style='font-family: \"VCR OSD Mono\"'>[##text]</span>"}

/// Macro from Lummox used to get height from a MeasureText proc.
/// resolves the MeasureText() return value once, then resolves the height, then sets return_var to that.
#define WXH_TO_HEIGHT(measurement, return_var) \
Expand Down
2 changes: 1 addition & 1 deletion code/__HELPERS/game.dm
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@
/proc/ScreenText(obj/O, maptext="", screen_loc="CENTER-7,CENTER-7", maptext_height=480, maptext_width=480)
if(!isobj(O))
O = new /atom/movable/screen/text()
O.maptext = maptext
O.maptext = MAPTEXT(maptext)
O.maptext_height = maptext_height
O.maptext_width = maptext_width
O.screen_loc = screen_loc
Expand Down
2 changes: 1 addition & 1 deletion code/__HELPERS/icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,7 @@ world
letter = lowertext(letter)

var/image/text_image = new(loc = A)
text_image.maptext = "<font size = 4>[letter]</font>"
text_image.maptext = MAPTEXT("<span style='font-size: 24pt'>[letter]</span>")
text_image.pixel_x = 7
text_image.pixel_y = 5
qdel(atom_icon)
Expand Down
4 changes: 2 additions & 2 deletions code/_onclick/hud/movable_screen_objects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
var/atom/movable/screen/movable/M = new()
M.name = "Movable UI Object"
M.icon_state = "block"
M.maptext = "Movable"
M.maptext = MAPTEXT("Movable")
M.maptext_width = 64

var/screen_l = input(usr,"Where on the screen? (Formatted as 'X,Y' e.g: '1,1' for bottom left)","Spawn Movable UI Object") as text
Expand All @@ -78,7 +78,7 @@
var/atom/movable/screen/movable/snap/S = new()
S.name = "Snap UI Object"
S.icon_state = "block"
S.maptext = "Snap"
S.maptext = MAPTEXT("Snap")
S.maptext_width = 64

var/screen_l = input(usr,"Where on the screen? (Formatted as 'X,Y' e.g: '1,1' for bottom left)","Spawn Snap UI Object") as text
Expand Down
4 changes: 2 additions & 2 deletions code/datums/action.dm
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@

/datum/action/cooldown/proc/StartCooldown()
next_use_time = world.time + cooldown_time
button.maptext = "<b>[round(cooldown_time/10, 0.1)]</b>"
button.maptext = MAPTEXT_TINY_UNICODE("[round(cooldown_time/10, 0.1)]")
UpdateButtonIcon()
START_PROCESSING(SSfastprocess, src)

Expand All @@ -742,7 +742,7 @@
UpdateButtonIcon()
STOP_PROCESSING(SSfastprocess, src)
else
button.maptext = "<b>[round(timeleft/10, 0.1)]</b>"
button.maptext = MAPTEXT_TINY_UNICODE("[round(timeleft/10, 0.1)]")

/datum/action/cooldown/Grant(mob/M)
..()
Expand Down
10 changes: 7 additions & 3 deletions code/datums/chatmessage.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#define CHAT_MESSAGE_EXP_DECAY 0.7 // Messages decay at pow(factor, idx in stack)
#define CHAT_MESSAGE_HEIGHT_DECAY 0.9 // Increase message decay based on the height of the message
#define CHAT_MESSAGE_APPROX_LHEIGHT 11 // Approximate height in pixels of an 'average' line, used for height decay
#define CHAT_MESSAGE_WIDTH 96 // pixels
#define CHAT_MESSAGE_WIDTH 112 // pixels
#define CHAT_MESSAGE_MAX_LENGTH 110 // characters

/**
Expand Down Expand Up @@ -100,6 +100,10 @@
if (!ismob(target))
extra_classes |= "small"

// Why are you yelling?
if(copytext_char(text, -2) == "!!")
extra_classes |= SPAN_YELL

var/list/prefixes

// Append radio icon if from a virtual speaker
Expand All @@ -121,7 +125,7 @@
// BYOND Bug #2563917
// Construct text
var/static/regex/html_metachars = new(@"&[A-Za-z]{1,7};", "g")
var/complete_text = "<span class='center maptext [extra_classes.Join(" ")]' style='color: [tgt_color]'>[owner.say_emphasis(text)]</span>"
var/complete_text = "<span style='color: [tgt_color]'><span class='center [extra_classes.Join(" ")]'>[owner.say_emphasis(text)]</span></span>"

var/mheight
WXH_TO_HEIGHT(owned_by.MeasureText(complete_text, null, CHAT_MESSAGE_WIDTH), mheight)
Expand Down Expand Up @@ -154,7 +158,7 @@
message.maptext_width = CHAT_MESSAGE_WIDTH
message.maptext_height = mheight
message.maptext_x = (CHAT_MESSAGE_WIDTH - owner.bound_width) * -0.5
message.maptext = complete_text
message.maptext = MAPTEXT(complete_text)

// View the message
LAZYADDASSOC(owned_by.seen_messages, message_loc, src)
Expand Down
2 changes: 1 addition & 1 deletion code/datums/components/storage/ui.dm
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
var/datum/numbered_display/ND = numbered_contents[type]
ND.sample_object.mouse_opacity = MOUSE_OPACITY_OPAQUE
ND.sample_object.screen_loc = "[cx]:[screen_pixel_x],[cy]:[screen_pixel_y]"
ND.sample_object.maptext = "<font color='white'>[(ND.number > 1)? "[ND.number]" : ""]</font>"
ND.sample_object.maptext = MAPTEXT("<font color='white'>[(ND.number > 1)? "[ND.number]" : ""]</font>")
ND.sample_object.layer = ABOVE_HUD_LAYER
ND.sample_object.plane = ABOVE_HUD_PLANE
. += ND.sample_object
Expand Down
6 changes: 3 additions & 3 deletions code/datums/explosion.dm
Original file line number Diff line number Diff line change
Expand Up @@ -393,13 +393,13 @@ GLOBAL_LIST_EMPTY(explosions)

if(dist < dev)
T.color = "red"
T.maptext = "Dev"
T.maptext = MAPTEXT("Dev")
else if (dist < heavy)
T.color = "yellow"
T.maptext = "Heavy"
T.maptext = MAPTEXT("Heavy")
else if (dist < light)
T.color = "blue"
T.maptext = "Light"
T.maptext = MAPTEXT("Light")
else
continue

Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/devices/gps.dm
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
// I assume it's faster to color,tag and OR the turf in, rather
// then checking if its there
T.color = RANDOM_COLOUR
T.maptext = "[T.x],[T.y],[T.z]"
T.maptext = MAPTEXT("[T.x],[T.y],[T.z]")
tagged |= T

/obj/item/gps/visible_debug/proc/clear()
Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/verbs/mapping.dm
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ GLOBAL_PROTECT(admin_verbs_debug_mapping)
for(var/turf/T in C.can_see())
seen[T]++
for(var/turf/T in seen)
T.maptext = "[seen[T]]"
T.maptext = MAPTEXT("[seen[T]]")
SSblackbox.record_feedback("tally", "admin_verb", 1, "Show Camera Range") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
SSblackbox.record_feedback("tally", "admin_verb", 1, "Show Camera Range")

Expand Down
2 changes: 1 addition & 1 deletion code/modules/clothing/glasses/engine_goggles.dm
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
var/strength = round(rad_places[i] / 1000, 0.1)
var/image/pic = image(loc = place)
var/mutable_appearance/MA = new()
MA.maptext = "<span class='maptext'>[strength]k</span>"
MA.maptext = MAPTEXT("[strength]k")
MA.color = "#04e604"
MA.layer = RAD_TEXT_LAYER
MA.plane = GAME_PLANE
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/dead/observer/observer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER)
final_appearance.appearance_flags |= KEEP_TOGETHER
final_appearance.blend_mode = original.blend_mode
final_appearance.color = original.color
final_appearance.maptext = original.maptext
final_appearance.maptext = MAPTEXT(original.maptext)
final_appearance.maptext_width = original.maptext_width
final_appearance.maptext_height = original.maptext_height
final_appearance.maptext_x = original.maptext_x
Expand Down
7 changes: 7 additions & 0 deletions fortune13.dme
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
#include "code\__DEFINES\exosuit_fabs.dm"
#include "code\__DEFINES\exports.dm"
#include "code\__DEFINES\fantasy_affixes.dm"
#include "code\__DEFINES\fonts.dm"
#include "code\__DEFINES\food.dm"
#include "code\__DEFINES\footsteps.dm"
#include "code\__DEFINES\generators.dm"
Expand Down Expand Up @@ -3754,6 +3755,12 @@
#include "interface\menu.dm"
#include "interface\stylesheet.dm"
#include "interface\skin.dmf"
#include "interface\fonts\fonts_datum.dm"
#include "interface\fonts\grand_9k.dm"
#include "interface\fonts\pixellari.dm"
#include "interface\fonts\spess_font.dm"
#include "interface\fonts\tiny_unicode.dm"
#include "interface\fonts\vcr_osd_mono.dm"
#include "modular_babylon\code\modules\examine_images.dm"
#include "modular_citadel\code\datums\components\souldeath.dm"
#include "modular_citadel\code\datums\status_effects\chems.dm"
Expand Down
Binary file added interface/fonts/Grand9K_Pixel.ttf
Binary file not shown.
Binary file added interface/fonts/Pixellari.ttf
Binary file not shown.
Binary file added interface/fonts/SpessFont.ttf
Binary file not shown.
Binary file added interface/fonts/TinyUnicode.ttf
Binary file not shown.
Binary file added interface/fonts/VCR_OSD_Mono.ttf
Binary file not shown.
78 changes: 78 additions & 0 deletions interface/fonts/fonts_datum.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/// A font datum, it exists to define a custom font to use in a span style later.
/datum/font
/// Font name, just so people know what to put in their span style.
var/name
/// The font file we link to.
var/font_family

/// Font features and metrics
/// Generated by Lummox's dmifontsplus (https://www.byond.com/developer/LummoxJR/DmiFontsPlus)
/// Note: these variable names have been changed, so you can't straight copy/paste from dmifontsplus.exe

/// list of font size/spacing metrics
var/list/metrics
/// total height of a line
var/height
/// distance above baseline (including whitespace)
var/ascent
/// distance below baseline
var/descent
/// average character width
var/average_width
/// maximum character width
var/max_width
/// extra width, such as from italics, for a line
var/overhang
/// internal leading vertical space, for accent marks
var/in_leading
/// external leading vertical space, just plain blank
var/ex_leading
/// default character (for undefined chars)
var/default_character
/// first character in metrics
var/start
/// last character in metrics
var/end

/// Get font metrics
/// From Lummox's dmifontsplus (https://www.byond.com/developer/LummoxJR/DmiFontsPlus)
/datum/font/proc/get_metrics(text, flags, first_line)
. = 0
var/longest = 0
if(!length(text))
return

var/i = 1
var/idx
while(i <= length(text))
var/character = text2ascii(text, i++)
if(character <= 10)
if(character <= 7)
. += character // spacers for justification

if(character <= 9)
continue // soft-break chars

if(. && idx && !(flags & INCLUDE_AC))
. -= max(metrics[idx + 3], 0)

longest = max(longest, . + first_line)
. = 0
first_line = 0
idx = 0
continue

idx = (character - start) * 3
if(idx <= 0 || idx >= metrics.len)
idx = (default_character - start) * 3

if(!. && !(flags & INCLUDE_AC))
. -= metrics[idx + 1]
. += metrics[idx + 1] + metrics[idx + 2] + metrics[idx +3]

if(. && idx && !(flags & INCLUDE_AC))
. -= max(metrics[idx + 3], 0)

. = max(. + first_line, longest)
if(. > 0)
. += overhang
Loading
Loading