diff --git a/sane/sane_option_trans.cpp b/sane/sane_option_trans.cpp index 4fc7979..8027002 100644 --- a/sane/sane_option_trans.cpp +++ b/sane/sane_option_trans.cpp @@ -214,6 +214,15 @@ namespace sane_opt_trans { VALUE_TO_TWAIN(g_paper_map, val); + std::string lat("\xe6\xa8\xaa\xe5\x90\x91"), // 横向 + v(to_default_language(val, nullptr)); + size_t pos = v.find(lat); + if (pos != std::string::npos) + { + v.erase(pos, lat.length()); + VALUE_TO_TWAIN(g_paper_map, v.c_str()); + } + return -1; } const char* switch_paper_lateral(const char* val) diff --git a/sane/scanner.cpp b/sane/scanner.cpp index 64e8a8f..68d67f1 100644 --- a/sane/scanner.cpp +++ b/sane/scanner.cpp @@ -1950,6 +1950,7 @@ EX_OPTION_HANDLER_IMPL(paper) int now = sane_opt_trans::paper_to_twain(buf), init = sane_opt_trans::paper_to_twain(def), val = 0; + std::vector exists; local_utility::free_memory(def); do @@ -1960,8 +1961,10 @@ EX_OPTION_HANDLER_IMPL(paper) { value_role role = VAL_ROLE_NONE; val = sane_opt_trans::paper_to_twain(desc->constraint.string_list[i]); - if (val == -1) + if (val == -1 || std::find(exists.begin(), exists.end(), val) != exists.end()) continue; + + exists.push_back(val); if (val == now) role = VAL_ROLE_CURRENT; if (val == init)