| 1 | package CXC::Gnuplot::V1::Font; | ||
| 2 | |||
| 3 | 1 | ▶ | use v5.38; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use experimental 'declared_refs'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 1 | ▶ | use Object::Pad 0.821; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 6 | |||
| 7 | our $VERSION = 'v0.29.3'; | ||
| 8 | |||
| 9 | class CXC::Gnuplot::V1::Font : isa(CXC::Gnuplot::V1::Base) does( CXC::Gnuplot::V1::Role::Clone ); | ||
| 10 | |||
| 11 | use CXC::Gnuplot::V1::Types -lexical, 'is_PositiveInt'; | ||
| 12 | use CXC::Gnuplot::V1::Util -lexical => 'to_hash_r', 'quote'; | ||
| 13 | |||
| 14 | my sub croak { | ||
| 15 | require Carp; | ||
| 16 | goto \&Carp::croak; | ||
| 17 | } | ||
| 18 | |||
| 19 | #<<< no tidy | ||
| 20 | field $name :param :reader = undef; | ||
| 21 | field $size :param :reader = undef; | ||
| 22 | #>>> | ||
| 23 | |||
| 24 | |||
| 25 | |||
| 26 | |||
| 27 | |||
| 28 | |||
| 29 | |||
| 30 | |||
| 31 | |||
| 32 | |||
| 33 | |||
| 34 | |||
| 35 | |||
| 36 | |||
| 37 | ADJUST { | ||
| 38 | |||
| 39 | defined $name | ||
| 40 | and !length $name | ||
| 41 | and croak( '"name" must be non-empty' ); | ||
| 42 | |||
| 43 | defined $size | ||
| 44 | and !is_PositiveInt( $size ) | ||
| 45 | and croak( '"size" must be a positive integer' ); | ||
| 46 | |||
| 47 | } | ||
| 48 | |||
| 49 | |||
| 50 | |||
| 51 | |||
| 52 | |||
| 53 | |||
| 54 | |||
| 55 | |||
| 56 | |||
| 57 | |||
| 58 | |||
| 59 | |||
| 60 | |||
| 61 | |||
| 62 | |||
| 63 | |||
| 64 | |||
| 65 | |||
| 66 | |||
| 67 | method to_hash ( %args ) { | ||
| 68 | to_hash_r( { | ||
| 69 | ( defined $name ? ( name => $name ) : () ), # | ||
| 70 | ( defined $size ? ( size => $size ) : () ), | ||
| 71 | } ); | ||
| 72 | } | ||
| 73 | |||
| 74 | |||
| 75 | |||
| 76 | |||
| 77 | |||
| 78 | |||
| 79 | method opts { | ||
| 80 | my $font = join( q{,}, $name // q{}, $size // () ); | ||
| 81 | return ( length( $font ) ? quote( $font ) : () ); | ||
| 82 | } | ||
| 83 | |||
| 84 | |||
| 85 | |||
| 86 | |||
| 87 | 1; | ||
| 88 | |||
| 89 | # | ||
| 90 | # This file is part of CXC-Gnuplot | ||
| 91 | # | ||
| 92 | # This software is Copyright (c) 2024 by Smithsonian Astrophysical Observatory. | ||
| 93 | # | ||
| 94 | # This is free software, licensed under: | ||
| 95 | # | ||
| 96 | # The GNU General Public License, Version 3, June 2007 | ||
| 97 | # | ||
| 98 | |||
| 99 | __END__ | ||