1
0
Fork 0
mirror of https://github.com/polybar/polybar.git synced 2024-11-11 13:50:56 -05:00
polybar/include/utils/units.hpp
patrick96 e904b408d1 fix(builder): ignored offsets
The builder::offset function returned immediately if a valid extent was
passed instead of when an invalid one was passed.
2022-03-14 22:58:01 +01:00

34 lines
926 B
C++

#pragma once
#include <cassert>
#include <cmath>
#include <stdexcept>
#include <string>
#include "components/types.hpp"
#include "utils/string.hpp"
POLYBAR_NS
namespace units_utils {
int point_to_pixel(double point, double dpi);
int extent_to_pixel(const extent_val size, double dpi);
unsigned extent_to_pixel_nonnegative(const extent_val size, double dpi);
extent_type parse_extent_unit(const string& str);
extent_val parse_extent(const string& str);
string extent_to_string(extent_val extent);
int percentage_with_offset_to_pixel(percentage_with_offset g_format, double max, double dpi);
unsigned percentage_with_offset_to_pixel_nonnegative(percentage_with_offset g_format, double max, double dpi);
spacing_type parse_spacing_unit(const string& str);
spacing_val parse_spacing(const string& str);
extent_val spacing_to_extent(spacing_val spacing);
} // namespace units_utils
POLYBAR_NS_END