From 4b01b1adc95b0732c28a0c00b090186d8364a55b Mon Sep 17 00:00:00 2001 From: gb <741021719@qq.com> Date: Thu, 19 Oct 2023 11:35:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=80=89=E6=8B=A9=E6=A8=AA?= =?UTF-8?q?=E5=90=91=E7=BA=B8=E5=BC=A0=E6=97=B6=E7=9A=84=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sane/sane_option_trans.cpp | 9 +++++++++ sane/scanner.cpp | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) 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)