Lines Matching +full:ascii +full:- +full:based

1 --
2 -- SPDX-License-Identifier: BSD-2-Clause
3 --
4 -- Copyright (c) 2015 Pedro Souza <pedrosouza@freebsd.org>
5 -- Copyright (c) 2018 Kyle Evans <kevans@FreeBSD.org>
6 -- All rights reserved.
7 --
8 -- Redistribution and use in source and binary forms, with or without
9 -- modification, are permitted provided that the following conditions
10 -- are met:
11 -- 1. Redistributions of source code must retain the above copyright
12 -- notice, this list of conditions and the following disclaimer.
13 -- 2. Redistributions in binary form must reproduce the above copyright
14 -- notice, this list of conditions and the following disclaimer in the
15 -- documentation and/or other materials provided with the distribution.
16 --
17 -- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 -- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 -- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 -- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 -- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 -- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 -- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 -- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 -- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 -- SUCH DAMAGE.
28 --
50 -- Make this code compatible with older loader binaries. We moved the term_*
51 -- functions from loader to the gfx. if we're running on an older loader that
52 -- has these functions, create aliases for them in gfx. The loader binary might
53 -- be so old as to not have them, but in that case, we want to copy the nil
54 -- values. The new loader will provide loader.* versions of all the gfx.*
55 -- functions for backwards compatibility, so we only define the functions we use
56 -- here.
80 local ret = try_include('gfx-' .. gfxname)
82 return false, "Failed to include gfx-" .. gfxname
85 -- Legacy format
104 -- Backwards compatibility shims for previous FreeBSD versions, please document
105 -- new additions
107 -- In FreeBSD 14.x+, we have improved framebuffer support in the loader
108 -- and some graphics may have images that we can actually draw on the
109 -- screen. Those graphics may come with shifts that are distinct from
110 -- the ASCII version, so we move both ascii and image versions into
111 -- their own tables.
112 if not def.ascii then
113 def.ascii = {
123 -- Legacy images may have adapted a shift from the ASCII
124 -- version, or perhaps we just didn't care enough to adjust it.
125 -- Steal the shift.
141 -- Look it up
144 -- Try to pull it in
148 -- This fallback should go away after FreeBSD 13.
149 try_include('brand-' .. brand)
150 -- If the fallback also failed, print whatever error
151 -- we encountered in the original processing.
170 -- Look it up
173 -- Try to pull it in
177 -- This fallback should go away after FreeBSD 13.
178 try_include('logo-' .. logo)
179 -- If the fallback also failed, print whatever error
180 -- we encountered in the original processing.
197 screen.setcursor(x, y + i - 1)
213 -- print the menu and build the alias table
222 -- Allow menu items to be conditionally visible by specifying
223 -- a visible function.
234 -- fill the alias table
252 return "ascii"
265 local x = menu_position.x - 3
266 local y = menu_position.y - 1
272 -- If we don't have a framespec for the current frame style, just don't
273 -- draw a box.
300 for _ = 1, w - 1 do
305 for _ = 1, w - 1 do
309 for i = 1, h - 1 do
319 local x = menu_position.x - 3
320 local y = menu_position.y - 1
341 -- Just inside the left border on top
344 -- Just inside the right border on top
345 menu_header_x = x + w - #menu_header
349 menu_header_x = x + (w // 2) - (#menu_header // 2)
351 screen.setcursor(menu_header_x - 1, y)
370 local graphic = branddef.ascii.image
384 elseif branddef.ascii.shift then
385 x = x + (branddef.ascii.shift.x or 0)
386 y = y + (branddef.ascii.shift.y or 0)
402 if logodef == nil or logodef.ascii == nil or
403 (not colored and logodef.ascii.requires_color) then
404 -- Choose a sensible default
411 -- Something has gone terribly wrong.
417 -- This is a special little hack for the "none" logo to re-align the
418 -- menu and the brand to avoid having a lot of extraneous whitespace on
419 -- the right side.
420 if logodef and logodef.ascii.image == none then
440 elseif logodef.ascii.shift then
441 x = x + (logodef.ascii.shift.x or 0)
442 y = y + (logodef.ascii.shift.y or 0)
445 draw(x, y, logodef.ascii.image)
470 -- Menu name handlers should take the menu being drawn and entry being
471 -- drawn as parameters, and return the name of the item.
472 -- This is designed so that everything, including menu separators, may
473 -- have their names derived differently. The default action for entry
474 -- types not specified here is to use entry.name directly.
499 -- Indexed by valid values for loader_brand in loader.conf(5). Valid
500 -- keys are: graphic (table depicting graphic)
502 ascii = {
506 image = "/boot/images/freebsd-brand-rev.png",
510 ascii = { image = none },
515 -- Indexed by valid values for loader_logo in loader.conf(5). Valid keys
516 -- are: requires_color (boolean), graphic (table depicting graphic), and
517 -- shift (table containing x and y).
519 ascii = {
524 ascii = {
529 ascii = {
543 -- Module exports
547 -- For when things go terribly wrong; this def should be present here in the
548 -- drawer module in case it's a filesystem issue.
560 -- Indexed by valid values for loader_menu_frame in loader.conf(5).
561 -- All of the keys appearing below must be set for any menu frame style
562 -- added to drawer.frame_styles.
563 ["ascii"] = {
564 horizontal = "-",
574 -- unicode based framing characters
592 -- non-unicode cons25-style framing characters
612 -- drawlogo() must go first.
613 -- it determines the positions of other elements