|
24 | 24 | #include <cstring>
|
25 | 25 | #include <iomanip> // for std::setw
|
26 | 26 | #include <locale> // for std::locale::classic
|
27 |
| -#include <sstream> // for std::istringstream |
| 27 | +#include <sstream> // for std::istringstream, std::ostringstream |
28 | 28 |
|
29 | 29 | #include "params.h"
|
30 | 30 | #include "serialis.h"
|
@@ -708,19 +708,24 @@ bool UNICHARSET::save_to_string(STRING *str) const {
|
708 | 708 | snprintf(buffer, kFileBufSize, "%s %x %s %d\n", "NULL", properties,
|
709 | 709 | this->get_script_from_script_id(this->get_script(id)),
|
710 | 710 | this->get_other_case(id));
|
| 711 | + *str += buffer; |
711 | 712 | } else {
|
712 |
| - // FIXME |
713 |
| - snprintf(buffer, kFileBufSize, |
714 |
| - "%s %x %d,%d,%d,%d,%g,%g,%g,%g,%g,%g %s %d %d %d %s\t# %s\n", |
715 |
| - this->id_to_unichar(id), properties, |
716 |
| - min_bottom, max_bottom, min_top, max_top, width, width_sd, |
717 |
| - bearing, bearing_sd, advance, advance_sd, |
718 |
| - this->get_script_from_script_id(this->get_script(id)), |
719 |
| - this->get_other_case(id), this->get_direction(id), |
720 |
| - this->get_mirror(id), this->get_normed_unichar(id), |
721 |
| - this->debug_str(id).string()); |
| 713 | + std::ostringstream stream; |
| 714 | + stream.imbue(std::locale::classic()); |
| 715 | + stream << this->id_to_unichar(id) << ' ' << properties << ' ' << |
| 716 | + min_bottom << ',' << max_bottom << ',' << |
| 717 | + min_top << ',' << max_top << ',' << |
| 718 | + width << ',' << width_sd << ',' << |
| 719 | + bearing << ',' << bearing_sd << ',' << |
| 720 | + advance << ',' << advance_sd << ' ' << |
| 721 | + this->get_script_from_script_id(this->get_script(id)) << ' ' << |
| 722 | + this->get_other_case(id) << ' ' << |
| 723 | + this->get_direction(id) << ' ' << |
| 724 | + this->get_mirror(id) << ' ' << |
| 725 | + this->get_normed_unichar(id) << "\t# " << |
| 726 | + this->debug_str(id).string() << '\n'; |
| 727 | + *str += stream.str().c_str(); |
722 | 728 | }
|
723 |
| - *str += buffer; |
724 | 729 | }
|
725 | 730 | return true;
|
726 | 731 | }
|
|
0 commit comments