Line data Source code
1 : /* File: geometry_v_align.inl; Copyright and License: see below */ 2 : 3 : #include "u8/u8_trace.h" 4 : #include "u8/u8_log.h" 5 : 6 0 : static inline double geometry_v_align_get_top ( const geometry_v_align_t *this_, double height, double reference_top, double reference_height ) 7 : { 8 : double top; 9 : 10 0 : switch ( *this_ ) 11 : { 12 0 : case GEOMETRY_V_ALIGN_TOP: 13 : { 14 0 : top = reference_top; 15 : } 16 0 : break; 17 : 18 0 : case GEOMETRY_V_ALIGN_CENTER: 19 : { 20 0 : top = reference_top + 0.5 * ( reference_height - height ); 21 : } 22 0 : break; 23 : 24 0 : case GEOMETRY_V_ALIGN_BOTTOM: 25 : { 26 0 : top = reference_top + reference_height - height; 27 : } 28 0 : break; 29 : 30 0 : default: 31 : { 32 0 : U8_LOG_ERROR("unknown geometry_v_align_t in geometry_v_align_get_top()"); 33 0 : assert(0); 34 : top = 0.0; 35 : } 36 : break; 37 : } 38 : 39 0 : return top; 40 : } 41 : 42 : 43 : /* 44 : Copyright 2017-2024 Andreas Warnke 45 : 46 : Licensed under the Apache License, Version 2.0 (the "License"); 47 : you may not use this file except in compliance with the License. 48 : You may obtain a copy of the License at 49 : 50 : http://www.apache.org/licenses/LICENSE-2.0 51 : 52 : Unless required by applicable law or agreed to in writing, software 53 : distributed under the License is distributed on an "AS IS" BASIS, 54 : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 55 : See the License for the specific language governing permissions and 56 : limitations under the License. 57 : */